Commit 72bdf0f9 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 288170: importxml.pl and move.pl should not write to $datadir/maillog -…

Bug 288170: importxml.pl and move.pl should not write to $datadir/maillog - Patch by Olav Vitters <bugzilla-mozilla@bkor.dhs.org> r=LpSolit a=justdave
parent 0892cf1c
......@@ -71,7 +71,6 @@ use Bugzilla::User;
require "CGI.pl";
require "globals.pl";
$::lockcount = 0;
GetVersionTable();
......@@ -117,40 +116,6 @@ sub MailMessage {
my $sendmessage = $header . $message . "\n";
Bugzilla::BugMail::MessageToMTA($sendmessage);
Log($subject . " sent to: $to");
}
sub Log {
my ($str) = (@_);
Lock();
open(FID, ">>$datadir/maillog") || die "Can't write to $datadir/maillog";
print FID time2str("%D %H:%M", time()) . ": $str\n";
close FID;
Unlock();
}
sub Lock {
if ($::lockcount <= 0) {
$::lockcount = 0;
open(LOCKFID, ">>$datadir/maillock") || die "Can't open $datadir/maillock: $!";
my $val = flock(LOCKFID,2);
if (!$val) { # '2' is magic 'exclusive lock' const.
print Bugzilla->cgi->header();
print "Lock failed: $val\n";
}
chmod 0666, "$datadir/maillock";
}
$::lockcount++;
}
sub Unlock {
$::lockcount--;
if ($::lockcount <= 0) {
flock(LOCKFID,8); # '8' is magic 'unlock' const.
close LOCKFID;
}
}
......
......@@ -36,8 +36,6 @@ use Bugzilla::Bug;
use Bugzilla::Config qw(:DEFAULT $datadir);
use Bugzilla::BugMail;
$::lockcount = 0;
unless ( Param("move-enabled") ) {
print "\n<P>Sorry. Bug moving is not enabled here. ";
print "If you need to move a bug, contact " . Param("maintainer");
......@@ -48,37 +46,6 @@ Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
sub Log {
my ($str) = (@_);
Lock();
open(FID, ">>$datadir/maillog") || die "Can't write to $datadir/maillog";
print FID time2str("%D %H:%M", time()) . ": $str\n";
close FID;
Unlock();
}
sub Lock {
if ($::lockcount <= 0) {
$::lockcount = 0;
open(LOCKFID, ">>$datadir/maillock") || die "Can't open $datadir/maillock: $!";
my $val = flock(LOCKFID,2);
if (!$val) { # '2' is magic 'exclusive lock' const.
print $cgi->header();
print "Lock failed: $val\n";
}
chmod 0666, "$datadir/maillock";
}
$::lockcount++;
}
sub Unlock {
$::lockcount--;
if ($::lockcount <= 0) {
flock(LOCKFID,8); # '8' is magic 'unlock' const.
close LOCKFID;
}
}
if (!defined $cgi->param('buglist')) {
print $cgi->header();
$template->put_header("Move Bugs");
......@@ -171,6 +138,3 @@ $template->process("bug/show.xml.tmpl", { bugs => \@bugs,
$msg .= "\n";
Bugzilla::BugMail::MessageToMTA($msg);
my $logstr = "XML: bugs $buglist sent to $to";
Log($logstr);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment