Commit 2c4ed3fd authored by jake%acutex.net's avatar jake%acutex.net

Bug 71552 - Remove oldemailtech from Bugzilla

r= justdave@syndicomm.com
parent c04fc5cc
...@@ -518,7 +518,6 @@ sub isExecutableFile { ...@@ -518,7 +518,6 @@ sub isExecutableFile {
} }
if ($my_webservergroup) { if ($my_webservergroup) {
mkdir 'shadow', 0770 unless -d 'shadow';
# Funny! getgrname returns the GID if fed with NAME ... # Funny! getgrname returns the GID if fed with NAME ...
my $webservergid = getgrnam($my_webservergroup); my $webservergid = getgrnam($my_webservergroup);
# chmod needs to be called with a valid uid, not 0. $< returns the # chmod needs to be called with a valid uid, not 0. $< returns the
...@@ -540,7 +539,7 @@ if ($my_webservergroup) { ...@@ -540,7 +539,7 @@ if ($my_webservergroup) {
} }
# make sure that contrib keeps the permissions it had (don't touch it) # make sure that contrib keeps the permissions it had (don't touch it)
chmod 0770, 'data', 'shadow', 'graphs'; chmod 0770, 'data', 'graphs';
chmod 0666, glob('data/*'); chmod 0666, glob('data/*');
chmod 01777, glob('data/*/'); # directories stay executable chmod 01777, glob('data/*/'); # directories stay executable
} }
...@@ -817,9 +816,7 @@ $table{profiles} = ...@@ -817,9 +816,7 @@ $table{profiles} =
cryptpassword varchar(64), cryptpassword varchar(64),
realname varchar(255), realname varchar(255),
groupset bigint not null, groupset bigint not null,
emailnotification enum("ExcludeSelfChanges", "CConly", "All") not null default "ExcludeSelfChanges",
disabledtext mediumtext, disabledtext mediumtext,
newemailtech tinyint not null default 1,
mybugslink tinyint not null default 1, mybugslink tinyint not null default 1,
blessgroupset bigint not null default 0, blessgroupset bigint not null default 0,
emailflags mediumtext, emailflags mediumtext,
...@@ -1186,7 +1183,6 @@ sub CheckEnumField ($$@) ...@@ -1186,7 +1183,6 @@ sub CheckEnumField ($$@)
$dbh->do("ALTER TABLE $table $dbh->do("ALTER TABLE $table
CHANGE $field CHANGE $field
$field $_"); $field $_");
$::regenerateshadow = 1;
} }
} }
...@@ -1328,8 +1324,8 @@ _End_Of_SQL_ ...@@ -1328,8 +1324,8 @@ _End_Of_SQL_
$dbh->do(<<_End_Of_SQL_); $dbh->do(<<_End_Of_SQL_);
INSERT INTO profiles INSERT INTO profiles
(login_name, realname, password, cryptpassword, groupset, newemailtech) (login_name, realname, password, cryptpassword, groupset)
VALUES ($login, $realname, $pass1, encrypt($pass1), 0x7fffffffffffffff, 1) VALUES ($login, $realname, $pass1, encrypt($pass1), 0x7fffffffffffffff)
_End_Of_SQL_ _End_Of_SQL_
} else { } else {
$dbh->do(<<_End_Of_SQL_); $dbh->do(<<_End_Of_SQL_);
...@@ -1467,8 +1463,6 @@ sub TableExists ($) ...@@ -1467,8 +1463,6 @@ sub TableExists ($)
return $exists; return $exists;
} }
$::regenerateshadow = 0;
# really old fields that were added before checksetup.pl existed # really old fields that were added before checksetup.pl existed
# but aren't in very old bugzilla's (like 2.1) # but aren't in very old bugzilla's (like 2.1)
...@@ -1484,14 +1478,6 @@ AddField('components', 'description', 'mediumtext not null'); ...@@ -1484,14 +1478,6 @@ AddField('components', 'description', 'mediumtext not null');
ChangeFieldType('components', 'program', 'varchar(64)'); ChangeFieldType('components', 'program', 'varchar(64)');
# 1999-05-12 Added a pref to control how much email you get. This needs a new
# column in the profiles table, so feed the following to mysql:
AddField('profiles', 'emailnotification', 'enum("ExcludeSelfChanges", "CConly",
"All") not null default "ExcludeSelfChanges"');
# 1999-06-22 Added an entry to the attachments table to record who the # 1999-06-22 Added an entry to the attachments table to record who the
# submitter was. Nothing uses this yet, but it still should be recorded. # submitter was. Nothing uses this yet, but it still should be recorded.
...@@ -1724,8 +1710,6 @@ if (GetFieldDef('bugs', 'long_desc')) { ...@@ -1724,8 +1710,6 @@ if (GetFieldDef('bugs', 'long_desc')) {
DropField('bugs', 'long_desc'); DropField('bugs', 'long_desc');
$dbh->do("UNLOCK TABLES"); $dbh->do("UNLOCK TABLES");
$::regenerateshadow = 1;
} }
...@@ -1768,14 +1752,14 @@ if (GetFieldDef('bugs_activity', 'field')) { ...@@ -1768,14 +1752,14 @@ if (GetFieldDef('bugs_activity', 'field')) {
# record when email notifications were last sent about this bug. Also, # record when email notifications were last sent about this bug. Also,
# added a user pref whether a user wants to use the brand new experimental # added a user pref whether a user wants to use the brand new experimental
# stuff. # stuff.
# 2001-04-29 jake@acutex.net - The newemailtech field is no longer needed
# http://bugzilla.mozilla.org/show_bugs.cgi?id=71552
if (!GetFieldDef('bugs', 'lastdiffed')) { if (!GetFieldDef('bugs', 'lastdiffed')) {
AddField('bugs', 'lastdiffed', 'datetime not null'); AddField('bugs', 'lastdiffed', 'datetime not null');
$dbh->do('UPDATE bugs SET lastdiffed = now(), delta_ts = delta_ts'); $dbh->do('UPDATE bugs SET lastdiffed = now(), delta_ts = delta_ts');
} }
AddField('profiles', 'newemailtech', 'tinyint not null');
# 2000-01-22 The "login_name" field in the "profiles" table was not # 2000-01-22 The "login_name" field in the "profiles" table was not
# declared to be unique. Sure enough, somehow, I got 22 duplicated entries # declared to be unique. Sure enough, somehow, I got 22 duplicated entries
...@@ -1999,8 +1983,6 @@ if ( CountIndexes('cc') != 3 ) { ...@@ -1999,8 +1983,6 @@ if ( CountIndexes('cc') != 3 ) {
DropIndexes('cc'); DropIndexes('cc');
$dbh->do("ALTER TABLE cc ADD UNIQUE (bug_id,who)"); $dbh->do("ALTER TABLE cc ADD UNIQUE (bug_id,who)");
$dbh->do("ALTER TABLE cc ADD INDEX (who)"); $dbh->do("ALTER TABLE cc ADD INDEX (who)");
$::regenerateshadow=1; # cc fields no longer have spaces in them
} }
if ( CountIndexes('keywords') != 3 ) { if ( CountIndexes('keywords') != 3 ) {
...@@ -2045,8 +2027,6 @@ if (!($sth->fetchrow_arrayref()->[0])) { ...@@ -2045,8 +2027,6 @@ if (!($sth->fetchrow_arrayref()->[0])) {
$dbh->do("INSERT INTO duplicates VALUES('$dupes{$key}', '$key')"); $dbh->do("INSERT INTO duplicates VALUES('$dupes{$key}', '$key')");
# BugItsADupeOf Dupe # BugItsADupeOf Dupe
} }
$::regenerateshadow = 1;
} }
# 2000-12-14 New graphing system requires a directory to put the graphs in # 2000-12-14 New graphing system requires a directory to put the graphs in
...@@ -2162,6 +2142,17 @@ unless (-d 'data/duplicates') { ...@@ -2162,6 +2142,17 @@ unless (-d 'data/duplicates') {
} }
} }
# 2001-04-29 jake@acutex.net - Remove oldemailtech
# http://bugzilla.mozilla.org/show_bugs.cgi?id=71552
if (-d 'shadow') {
print "Removing shadow directory...\n";
unlink glob("shadow/*");
unlink glob("shadow/.*");
rmdir "shadow";
}
DropField("profiles", "emailnotification");
DropField("profiles", "newemailtech");
# If you had to change the --TABLE-- definition in any way, then add your # If you had to change the --TABLE-- definition in any way, then add your
# differential change code *** A B O V E *** this comment. # differential change code *** A B O V E *** this comment.
# #
...@@ -2173,10 +2164,6 @@ unless (-d 'data/duplicates') { ...@@ -2173,10 +2164,6 @@ unless (-d 'data/duplicates') {
# #
# #
# Final checks... # Final checks...
if ($::regenerateshadow) {
print "Now regenerating the shadow database for all bugs.\n";
system("./processmail", "regenerate");
}
unlink "data/versioncache"; unlink "data/versioncache";
print "Reminder: Bugzilla now requires version 8.7 or later of sendmail.\n"; print "Reminder: Bugzilla now requires version 8.7 or later of sendmail.\n";
...@@ -145,11 +145,6 @@ DefParam("preferlists", ...@@ -145,11 +145,6 @@ DefParam("preferlists",
"b", "b",
1); 1);
DefParam("prettyasciimail",
"If this is on, Bugzilla will send email reports formatted (assuming 76 character monospace font display). If this is off, email reports are sent using the old 'one-item-per-line' format.",
"b",
0);
DefParam("capitalizelists", DefParam("capitalizelists",
"If this is on, Bugzilla will capitalize list entries, checkboxes, and radio buttons. If this is off, Bugzilla will leave these items untouched.", "If this is on, Bugzilla will capitalize list entries, checkboxes, and radio buttons. If this is off, Bugzilla will leave these items untouched.",
"b", "b",
...@@ -374,51 +369,18 @@ To use the wonders of Bugzilla, you can use the following: ...@@ -374,51 +369,18 @@ To use the wonders of Bugzilla, you can use the following:
}); });
DefParam("changedmail",
q{The email that gets sent to people when a bug changes. Within this
text, %to% gets replaced by the assigned-to and reported-by people,
separated by a comma (with duplication removed, if they're the same
person). %cc% gets replaced by the list of people on the CC list,
separated by commas. %bugid% gets replaced by the bug number.
%diffs% gets replaced by the diff text from the old version to the new
version of this bug. %neworchanged% is "New: " if this mail is
reporting a new bug or empty if changes were made
to an existing one. %summary% gets replaced by the summary of this
bug. %<i>anythingelse</i>% gets replaced by the definition of that
parameter (as defined on this page).},
"l",
"From: bugzilla-daemon
To: %to%
Cc: %cc%
Subject: [Bug %bugid%] %neworchanged%%summary%
%urlbase%show_bug.cgi?id=%bugid%
%diffs%");
DefParam("newemailtech",
q{The way that email diffs are constructed by Bugzilla. You can revert to
the old technology by turning this off, but this is not advised, as the old
email tech will probably disappear in the next version of Bugzilla. Some
features (watches, server side mail filtering) depend on newemailtech being
set to on.},
"b",
1);
DefParam("newemailtechdefault",
q{Make "newemailtech" the default for all new accounts created. This will
not change any existing accounts nor will it remove a users ability to go
back to the oldmail system (requires "newemailtech" to be on as well).},
"b",
1);
DefParam("newchangedmail", DefParam("newchangedmail",
q{The same as 'changedmail', but used for the newemailtech stuff.}, q{The email that gets sent to people when a bug changes. Within this
text, %to% gets replaced with the e-mail address of the person recieving
the mail. %bugid% gets replaced by the bug number. %diffs% gets
replaced with what's changed. %neworchanged% is "New:" if this mail is
reporting a new bug or empty if changes were made to an existing one.
%summary% gets replaced by the summary of this bug. %<i>anythingelse</i>%
gets replaced by the definition of that parameter (as defined on this
page).},
"l", "l",
"From: bugzilla-daemon "From: bugzilla-daemon
To: %to% To: %to%
Cc: %cc%
Subject: [Bug %bugid%] %neworchanged%%summary% Subject: [Bug %bugid%] %neworchanged%%summary%
%urlbase%show_bug.cgi?id=%bugid% %urlbase%show_bug.cgi?id=%bugid%
......
...@@ -97,10 +97,10 @@ sub EmitElement ($$) ...@@ -97,10 +97,10 @@ sub EmitElement ($$)
# Displays the form to edit a user parameters # Displays the form to edit a user parameters
# #
sub EmitFormElements ($$$$$$$$) sub EmitFormElements ($$$$$$)
{ {
my ($user, $password, $realname, $groupset, $blessgroupset, my ($user, $password, $realname, $groupset, $blessgroupset,
$emailnotification, $disabledtext, $newemailtech) = @_; $disabledtext) = @_;
print " <TH ALIGN=\"right\">Login name:</TH>\n"; print " <TH ALIGN=\"right\">Login name:</TH>\n";
EmitElement("user", $user); EmitElement("user", $user);
...@@ -119,25 +119,6 @@ sub EmitFormElements ($$$$$$$$) ...@@ -119,25 +119,6 @@ sub EmitFormElements ($$$$$$$$)
} }
print "</TR><TR>\n"; print "</TR><TR>\n";
if (!$newemailtech) {
print " <TH ALIGN=\"right\">Email notification:</TH>\n";
print qq{<TD><SELECT NAME="emailnotification">};
foreach my $i (["ExcludeSelfChanges",
"All qualifying bugs except those which I change"],
["CConly",
"Only those bugs which I am listed on the CC line"],
["All", "All qualifying bugs"]) {
my ($tag, $desc) = (@$i);
my $selectpart = "";
if ($tag eq $emailnotification) {
$selectpart = " SELECTED";
}
print qq{<OPTION$selectpart VALUE="$tag">$desc\n};
}
print "</SELECT></TD>\n";
print "</TR><TR>\n";
}
print " <TH ALIGN=\"right\">Disable text:</TH>\n"; print " <TH ALIGN=\"right\">Disable text:</TH>\n";
print " <TD ROWSPAN=2><TEXTAREA NAME=\"disabledtext\" ROWS=10 COLS=60>" . print " <TD ROWSPAN=2><TEXTAREA NAME=\"disabledtext\" ROWS=10 COLS=60>" .
value_quote($disabledtext) . "</TEXTAREA>\n"; value_quote($disabledtext) . "</TEXTAREA>\n";
...@@ -397,7 +378,7 @@ if ($action eq 'add') { ...@@ -397,7 +378,7 @@ if ($action eq 'add') {
print "<FORM METHOD=POST ACTION=editusers.cgi>\n"; print "<FORM METHOD=POST ACTION=editusers.cgi>\n";
print "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=0><TR>\n"; print "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=0><TR>\n";
EmitFormElements('', '', '', 0, 0, 'ExcludeSelfChanges', '', 1); EmitFormElements('', '', '', 0, 0, '');
print "</TR></TABLE>\n<HR>\n"; print "</TR></TABLE>\n<HR>\n";
print "<INPUT TYPE=SUBMIT VALUE=\"Add\">\n"; print "<INPUT TYPE=SUBMIT VALUE=\"Add\">\n";
...@@ -515,10 +496,9 @@ if ($action eq 'del') { ...@@ -515,10 +496,9 @@ if ($action eq 'del') {
CheckUser($user); CheckUser($user);
# display some data about the user # display some data about the user
SendSQL("SELECT realname, groupset, emailnotification, newemailtech SendSQL("SELECT realname, groupset FROM profiles
FROM profiles
WHERE login_name=" . SqlQuote($user)); WHERE login_name=" . SqlQuote($user));
my ($realname, $groupset, $emailnotification, $newemailtech) = my ($realname, $groupset) =
FetchSQLData(); FetchSQLData();
$realname ||= "<FONT COLOR=\"red\">missing</FONT>"; $realname ||= "<FONT COLOR=\"red\">missing</FONT>";
...@@ -535,12 +515,6 @@ if ($action eq 'del') { ...@@ -535,12 +515,6 @@ if ($action eq 'del') {
print " <TD VALIGN=\"top\">Real name:</TD>\n"; print " <TD VALIGN=\"top\">Real name:</TD>\n";
print " <TD VALIGN=\"top\">$realname</TD>\n"; print " <TD VALIGN=\"top\">$realname</TD>\n";
if ( !$newemailtech ) {
print "</TR><TR>\n";
print " <TD VALIGN=\"top\">E-Mail notification:</TD>\n";
print " <TD VALIGN=\"top\">$emailnotification</TD>\n";
}
print "</TR><TR>\n"; print "</TR><TR>\n";
print " <TD VALIGN=\"top\">Group set:</TD>\n"; print " <TD VALIGN=\"top\">Group set:</TD>\n";
print " <TD VALIGN=\"top\">"; print " <TD VALIGN=\"top\">";
...@@ -680,18 +654,17 @@ if ($action eq 'edit') { ...@@ -680,18 +654,17 @@ if ($action eq 'edit') {
CheckUser($user); CheckUser($user);
# get data of user # get data of user
SendSQL("SELECT password, realname, groupset, blessgroupset, SendSQL("SELECT password, realname, groupset, blessgroupset, disabledtext
emailnotification, disabledtext, newemailtech
FROM profiles FROM profiles
WHERE login_name=" . SqlQuote($user)); WHERE login_name=" . SqlQuote($user));
my ($password, $realname, $groupset, $blessgroupset, $emailnotification, my ($password, $realname, $groupset, $blessgroupset,
$disabledtext, $newemailtech) = FetchSQLData(); $disabledtext) = FetchSQLData();
print "<FORM METHOD=POST ACTION=editusers.cgi>\n"; print "<FORM METHOD=POST ACTION=editusers.cgi>\n";
print "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=0><TR>\n"; print "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=0><TR>\n";
EmitFormElements($user, $password, $realname, $groupset, $blessgroupset, EmitFormElements($user, $password, $realname, $groupset, $blessgroupset,
$emailnotification, $disabledtext, $newemailtech); $disabledtext);
print "</TR></TABLE>\n"; print "</TR></TABLE>\n";
...@@ -702,10 +675,6 @@ if ($action eq 'edit') { ...@@ -702,10 +675,6 @@ if ($action eq 'edit') {
print "<INPUT TYPE=HIDDEN NAME=\"realnameold\" VALUE=\"$realname\">\n"; print "<INPUT TYPE=HIDDEN NAME=\"realnameold\" VALUE=\"$realname\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"groupsetold\" VALUE=\"$groupset\">\n"; print "<INPUT TYPE=HIDDEN NAME=\"groupsetold\" VALUE=\"$groupset\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"blessgroupsetold\" VALUE=\"$blessgroupset\">\n"; print "<INPUT TYPE=HIDDEN NAME=\"blessgroupsetold\" VALUE=\"$blessgroupset\">\n";
if (!$newemailtech) {
print "<INPUT TYPE=HIDDEN NAME=\"emailnotificationold\" " .
"VALUE=\"$emailnotification\">\n";
}
print "<INPUT TYPE=HIDDEN NAME=\"disabledtextold\" VALUE=\"" . print "<INPUT TYPE=HIDDEN NAME=\"disabledtextold\" VALUE=\"" .
value_quote($disabledtext) . "\">\n"; value_quote($disabledtext) . "\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"action\" VALUE=\"update\">\n"; print "<INPUT TYPE=HIDDEN NAME=\"action\" VALUE=\"update\">\n";
...@@ -731,8 +700,6 @@ if ($action eq 'update') { ...@@ -731,8 +700,6 @@ if ($action eq 'update') {
my $realnameold = trim($::FORM{realnameold} || ''); my $realnameold = trim($::FORM{realnameold} || '');
my $password = trim($::FORM{password} || ''); my $password = trim($::FORM{password} || '');
my $passwordold = trim($::FORM{passwordold} || ''); my $passwordold = trim($::FORM{passwordold} || '');
my $emailnotification = trim($::FORM{emailnotification} || '');
my $emailnotificationold = trim($::FORM{emailnotificationold} || '');
my $disabledtext = trim($::FORM{disabledtext} || ''); my $disabledtext = trim($::FORM{disabledtext} || '');
my $disabledtextold = trim($::FORM{disabledtextold} || ''); my $disabledtextold = trim($::FORM{disabledtextold} || '');
my $groupsetold = trim($::FORM{groupsetold} || '0'); my $groupsetold = trim($::FORM{groupsetold} || '0');
...@@ -796,12 +763,6 @@ if ($action eq 'update') { ...@@ -796,12 +763,6 @@ if ($action eq 'update') {
print "Updated ability to tweak permissions of other users.\n"; print "Updated ability to tweak permissions of other users.\n";
} }
if ($editall && $emailnotification ne $emailnotificationold) {
SendSQL("UPDATE profiles
SET emailnotification=" . SqlQuote($emailnotification) . "
WHERE login_name=" . SqlQuote($userold));
print "Updated email notification.<BR>\n";
}
if(!Param('useLDAP')) { if(!Param('useLDAP')) {
if ($editall && $password ne $passwordold) { if ($editall && $password ne $passwordold) {
my $q = SqlQuote($password); my $q = SqlQuote($password);
......
...@@ -585,7 +585,6 @@ sub InsertNewUser { ...@@ -585,7 +585,6 @@ sub InsertNewUser {
for (my $i=0 ; $i<8 ; $i++) { for (my $i=0 ; $i<8 ; $i++) {
$password .= substr("abcdefghijklmnopqrstuvwxyz", int(rand(26)), 1); $password .= substr("abcdefghijklmnopqrstuvwxyz", int(rand(26)), 1);
} }
my $usenewemailtech = Param('newemailtech') & Param('newemailtechdefault');
PushGlobalSQLState(); PushGlobalSQLState();
SendSQL("select bit, userregexp from groups where userregexp != ''"); SendSQL("select bit, userregexp from groups where userregexp != ''");
...@@ -605,7 +604,7 @@ sub InsertNewUser { ...@@ -605,7 +604,7 @@ sub InsertNewUser {
$username = SqlQuote($username); $username = SqlQuote($username);
$realname = SqlQuote($realname); $realname = SqlQuote($realname);
SendSQL("insert into profiles (login_name, realname, password, cryptpassword, groupset, newemailtech) values ($username, $realname, '$password', encrypt('$password'), $groupset, $usenewemailtech)"); SendSQL("insert into profiles (login_name, realname, password, cryptpassword, groupset) values ($username, $realname, '$password', encrypt('$password'), $groupset)");
PopGlobalSQLState(); PopGlobalSQLState();
return $password; return $password;
} }
......
...@@ -22,10 +22,9 @@ ...@@ -22,10 +22,9 @@
# Bryce Nesbitt <bryce-mozilla@nextbus.com> # Bryce Nesbitt <bryce-mozilla@nextbus.com>
# Dan Mosedale <dmose@mozilla.org> # Dan Mosedale <dmose@mozilla.org>
# Alan Raetz <al_raetz@yahoo.com> # Alan Raetz <al_raetz@yahoo.com>
# Jacob Steenhagen <jake@actex.net>
# #
# To recreate the shadow database, run "processmail regenerate" .
use diagnostics; use diagnostics;
use strict; use strict;
...@@ -37,9 +36,8 @@ $| = 1; ...@@ -37,9 +36,8 @@ $| = 1;
umask(0); umask(0);
$::lockcount = 0;
my $regenerate = 0;
my $nametoexclude = ""; my $nametoexclude = "";
my %nomail;
my @excludedAddresses = (); my @excludedAddresses = ();
...@@ -53,276 +51,9 @@ my %force; ...@@ -53,276 +51,9 @@ my %force;
@{$force{'CClist'}} = (); @{$force{'CClist'}} = ();
@{$force{'Voter'}} = (); @{$force{'Voter'}} = ();
sub Lock {
if ($::lockcount <= 0) {
$::lockcount = 0;
if (!open(LOCKFID, ">>data/maillock")) {
mkdir "data", 0777;
chmod 0777, "data";
open(LOCKFID, ">>data/maillock") || die "Can't open lockfile.";
}
my $val = flock(LOCKFID,2);
if (!$val) { # '2' is magic 'exclusive lock' const.
print "Lock failed: $val\n";
}
chmod 0666, "data/maillock";
}
$::lockcount++;
}
sub Unlock {
$::lockcount--;
if ($::lockcount <= 0) {
flock(LOCKFID,8); # '8' is magic 'unlock' const.
close LOCKFID;
}
}
sub FileSize {
my ($filename) = (@_);
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);
if (defined $size) {
return $size;
}
return -1;
}
sub Different {
my ($file1, $file2) = (@_);
my $size1 = FileSize($file1);
my $size2 = FileSize($file2);
if ($size1 != $size2) {
return 1;
}
open(FID1, "<$file1") || die "Can't open $file1";
open(FID2, "<$file2") || die "Can't open $file2";
my $d1;
my $d2;
if (read(FID1, $d1, $size1) ne $size1) {
die "Can't read $size1 bytes from $file1";
}
if (read(FID2, $d2, $size2) ne $size2) {
die "Can't read $size2 bytes from $file2";
}
close FID1;
close FID2;
return ($d1 ne $d2);
}
sub DescCC {
my $cclist = shift();
return "" if ( $cclist->size() == 0 );
return "Cc: " . $cclist->toString() . "\n";
}
sub DescDependencies {
my ($id) = (@_);
if (!Param("usedependencies")) {
return "";
}
my $result = "";
my $me = "blocked";
my $target = "dependson";
my $title = "BugsThisDependsOn";
for (1..2) {
SendSQL("select $target from dependencies where $me = $id order by $target");
my @list;
while (MoreSQLData()) {
push(@list, FetchOneColumn());
}
if (@list) {
my @verbose;
my $count = 0;
foreach my $i (@list) {
SendSQL("select bug_status, resolution from bugs where bug_id = $i");
my ($bug_status, $resolution) = (FetchSQLData());
my $desc;
if ($bug_status eq "NEW" || $bug_status eq "ASSIGNED" ||
$bug_status eq "REOPENED" || $bug_status eq "UNCONFIRMED") {
$desc = "";
} else {
$desc = "[$resolution]";
}
push(@verbose, $i . "$desc");
$count++;
}
if ($count > 5) {
$result .= "$title: Big list (more than 5) has been omitted\n";
} else {
$result .= "$title: " . join(', ', @verbose) . "\n";
}
}
my $tmp = $me;
$me = $target;
$target = $tmp;
$title = "OtherBugsDependingOnThis";
}
return $result;
}
sub GetBugText {
my ($id) = (@_);
undef %::bug;
my @collist = ("bug_id", "product", "version", "rep_platform", "op_sys",
"bug_status", "resolution", "priority", "bug_severity",
"assigned_to", "reporter", "bug_file_loc",
"short_desc", "component", "qa_contact", "target_milestone",
"status_whiteboard", "groupset");
my $query = "select " . join(", ", @collist) .
" from bugs where bug_id = $id";
SendSQL($query);
my @row;
if (!(@row = FetchSQLData())) {
return "";
}
foreach my $field (@collist) {
$::bug{$field} = shift @row;
if (!defined $::bug{$field}) {
$::bug{$field} = "";
}
}
$::bug{'assigned_to'} = DBID_to_name($::bug{'assigned_to'});
$::bug{'reporter'} = DBID_to_name($::bug{'reporter'});
my $qa_contact = "";
my $target_milestone = "";
my $status_whiteboard = "";
if (Param('useqacontact') && $::bug{'qa_contact'} > 0) {
$::bug{'qa_contact'} = DBID_to_name($::bug{'qa_contact'});
$qa_contact = "QAContact: $::bug{'qa_contact'}\n";
} else {
$::bug{'qa_contact'} = "";
}
if (Param('usetargetmilestone') && $::bug{'target_milestone'} ne "") {
$target_milestone = "TargetMilestone: $::bug{'target_milestone'}\n";
}
if (Param('usestatuswhiteboard') && $::bug{'status_whiteboard'} ne "") {
$status_whiteboard = "StatusWhiteboard: $::bug{'status_whiteboard'}\n";
}
$::bug{'long_desc'} = GetLongDescriptionAsText($id);
my $cclist = new RelationSet();
$cclist->mergeFromDB("select who from cc where bug_id = $id");
my @voterlist;
SendSQL("select profiles.login_name from votes, profiles where votes.bug_id = $id and profiles.userid = votes.who");
while (MoreSQLData()) {
my $v = FetchOneColumn();
push(@voterlist, $v);
}
$::bug{'cclist'} = $cclist->toString();
$::bug{'voterlist'} = join(',', @voterlist);
if (Param("prettyasciimail")) {
$^A = "";
my $temp = formline <<'END',$::bug{'short_desc'},$id,$::bug{'product'},$::bug{'bug_status'},$::bug{'version'},$::bug{'resolution'},$::bug{'rep_platform'},$::bug{'bug_severity'},$::bug{'op_sys'},$::bug{'priority'},$::bug{'component'},$::bug{'assigned_to'},$::bug{'reporter'},$qa_contact,DescCC($cclist),$target_milestone,${status_whiteboard},$::bug{'bug_file_loc'},DescDependencies($id);
+============================================================================+
| @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
+----------------------------------------------------------------------------+
| Bug #: @<<<<<<<<<<< Product: @<<<<<<<<<<<<<<<<<<<<<< |
| Status: @<<<<<<<<<<<<<<<<<< Version: @<<<<<<<<<<<<<<<<<<<<<< |
| Resolution: @<<<<<<<<<<<<<<<<<< Platform: @<<<<<<<<<<<<<<<<<<<<<< |
| Severity: @<<<<<<<<<<<<<<<<<< OS/Version: @<<<<<<<<<<<<<<<<<<<<<< |
| Priority: @<<<<<<<<<<<<<<<<<< Component: @<<<<<<<<<<<<<<<<<<<<<< |
+----------------------------------------------------------------------------+
| Assigned To: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
| Reported By: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
| ~QA Contact: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
| ~ CC list: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
+----------------------------------------------------------------------------+
| ~ Milestone: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
|~ Whiteboard: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
| URL: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
|~Dependencies: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
+============================================================================+
| DESCRIPTION |
END
my $prettymail = $^A . $::bug{'long_desc'};
return $prettymail;
} else {
return "Bug\#: $id
Product: $::bug{'product'}
Version: $::bug{'version'}
Platform: $::bug{'rep_platform'}
OS/Version: $::bug{'op_sys'}
Status: $::bug{'bug_status'}
Resolution: $::bug{'resolution'}
Severity: $::bug{'bug_severity'}
Priority: $::bug{'priority'}
Component: $::bug{'component'}
AssignedTo: $::bug{'assigned_to'}
ReportedBy: $::bug{'reporter'}
$qa_contact$target_milestone${status_whiteboard}URL: $::bug{'bug_file_loc'}
" . DescCC($cclist) . "Summary: $::bug{'short_desc'}
" . DescDependencies($id) . "
$::bug{'long_desc'}
";
}
}
my %seen; my %seen;
my @sentlist; my @sentlist;
sub fixaddresses {
my ($field, $list) = (@_);
my @result;
foreach my $i (@$list) {
if (!defined $i || $i eq "") {
next;
}
SendSQL("select emailnotification, groupset & $::bug{'groupset'} from profiles where login_name = " .
SqlQuote($i));
my ($emailnotification, $groupset) = (FetchSQLData());
if ($groupset ne $::bug{'groupset'}) {
next;
}
if ($emailnotification eq "CConly") {
if ($field ne "cc") {
next;
}
}
if ($emailnotification eq "ExcludeSelfChanges" &&
(lc($i) eq $nametoexclude)) {
push @excludedAddresses, $nametoexclude;
next;
}
if (!defined $::nomail{$i} && !defined $seen{$i}) {
push(@result, $i . Param('emailsuffix'));
$seen{$i} = 1;
}
}
return join(", ", @result);
}
sub Log {
my ($str) = (@_);
Lock();
open(FID, ">>data/maillog") || die "Can't write to data/maillog";
print FID time2str("%D %H:%M", time()) . ": $str\n";
close FID;
Unlock();
}
sub FormatTriple { sub FormatTriple {
my ($a, $b, $c) = (@_); my ($a, $b, $c) = (@_);
...@@ -346,7 +77,7 @@ END ...@@ -346,7 +77,7 @@ END
} }
sub NewProcessOneBug { sub ProcessOneBug {
my ($id) = (@_); my ($id) = (@_);
my @headerlist; my @headerlist;
...@@ -473,25 +204,13 @@ sub NewProcessOneBug { ...@@ -473,25 +204,13 @@ sub NewProcessOneBug {
my $newcomments = GetLongDescriptionAsText($id, $start, $end); my $newcomments = GetLongDescriptionAsText($id, $start, $end);
if (Param('newemailtech')) {
# #
# Start of email filtering code # Start of email filtering code
# #
# Even if the user sending the email has not enabled #
# 'newEmailTech', we still want to filter the email
# based on other user's email preferences if the global Param
# 'newemailtech' is enabled.
#
# Note: users who have not enabled newEmailTech will default
# to no filtering (they will get all email Bugzilla sends).
my $count = 0; my $count = 0;
my @currentEmailAttributes = getEmailAttributes($newcomments, my @currentEmailAttributes = getEmailAttributes($newcomments, @diffs);
@diffs); my (@assigned_toList,@reporterList,@qa_contactList,@ccList) = ();
my (@assigned_toList,@reporterList,@qa_contactList,@ccList) =
();
#open(LOG, ">>/tmp/maillog"); #open(LOG, ">>/tmp/maillog");
#print LOG "\nBug ID: $id CurrentEmailAttributes:"; #print LOG "\nBug ID: $id CurrentEmailAttributes:";
...@@ -555,37 +274,26 @@ sub NewProcessOneBug { ...@@ -555,37 +274,26 @@ sub NewProcessOneBug {
} }
} }
} else {
my $count = 0;
my @personlist = ($values{'assigned_to'}, $values{'reporter'},
split(/,/, $values{'cc'}),
@voterlist,
$force{'CClist'});
if ($values{'qa_contact'}) { push @personlist, $values{'qa_contact'} }
for my $person (@personlist) {
$count++;
my $match = "^[^@, ]*@[^@, ]*\.[^@, ]*\$";
if ($person !~ /$match/) {
$person = $person . Param('emailsuffix');
}
if ( !defined(NewProcessOnePerson($person, $count, \@headerlist, SendSQL("UPDATE bugs SET lastdiffed = '$end', delta_ts = delta_ts " .
\%values, \%defmailhead, "WHERE bug_id = $id");
\%fielddescription, $difftext,
$newcomments, $start, $id))) {
# if a value is not returned, this means that the person # Filter the exclude list for dupes one last time
# was not sent mail. add them to the excludedAddresses list. @excludedAddresses = filterExcludeList(\@excludedAddresses,
# it will be filtered later for dups. \@sentlist);
# if (@sentlist) {
push @excludedAddresses, $person; print "<b>Email sent to:</b> " . join(", ", @sentlist) ."<br>\n";
} } else {
print "<b>Email sent to:</b> no one<br>\n";
} }
if (@excludedAddresses) {
print "<b>Excluding:</b> " . join(", ", @excludedAddresses) . "\n";
} }
SendSQL("UPDATE bugs SET lastdiffed = '$end', delta_ts = delta_ts " . print "<br><center>If you wish to tweak the kinds of mail Bugzilla sends you, you can";
"WHERE bug_id = $id"); print " <a href=\"userprefs.cgi?bank=diffs\">change your preferences</a></center>\n";
} }
# When one person is in different fields on one bug, they may be # When one person is in different fields on one bug, they may be
...@@ -775,18 +483,10 @@ sub filterEmailGroup ($$$) { ...@@ -775,18 +483,10 @@ sub filterEmailGroup ($$$) {
next; next;
} }
SendSQL("SELECT emailflags, newemailtech FROM profiles WHERE " . SendSQL("SELECT emailflags FROM profiles WHERE " .
"userid = $userid" ); "userid = $userid" );
my ($userFlagString, $newemailtech) = FetchSQLData(); my ($userFlagString) = FetchSQLData();
# people who are not using newemailtech get skipped; they will
# be dealt with later by the old email tech code in
# ProcessOneBug().
#
if (!defined($newemailtech) || $newemailtech == 0) {
next;
}
# If the sender doesn't want email, exclude them from list # If the sender doesn't want email, exclude them from list
...@@ -917,15 +617,14 @@ sub NewProcessOnePerson ($$$$$$$$$$) { ...@@ -917,15 +617,14 @@ sub NewProcessOnePerson ($$$$$$$$$$) {
return; return;
} }
SendSQL("SELECT userid, emailnotification, newemailtech," . if ($nomail{$person}) {
" groupset & $values{'groupset'} " .
"FROM profiles WHERE login_name = " . SqlQuote($person));
my ($userid, $emailnotification, $newemailtech,
$groupset) = (FetchSQLData());
if (!$newemailtech || !Param('newemailtech')) {
return; return;
} }
SendSQL("SELECT userid, groupset & $values{'groupset'} " .
"FROM profiles WHERE login_name = " . SqlQuote($person));
my ($userid, $groupset) = (FetchSQLData());
$seen{$person} = 1; $seen{$person} = 1;
...@@ -940,16 +639,6 @@ sub NewProcessOnePerson ($$$$$$$$$$) { ...@@ -940,16 +639,6 @@ sub NewProcessOnePerson ($$$$$$$$$$) {
if ($groupset ne $values{'groupset'}) { if ($groupset ne $values{'groupset'}) {
return; return;
} }
if ($emailnotification eq "ExcludeSelfChanges" &&
lc($person) eq $nametoexclude) {
push @excludedAddresses, $nametoexclude;
return;
}
# "$count < 3" means "this person is either assigned_to or reporter"
#
if ($emailnotification eq "CCOnly" && $count < 3) {
return;
}
my %mailhead = %defmailhead; my %mailhead = %defmailhead;
...@@ -1013,160 +702,20 @@ sub NewProcessOnePerson ($$$$$$$$$$) { ...@@ -1013,160 +702,20 @@ sub NewProcessOnePerson ($$$$$$$$$$) {
return 1; return 1;
} }
sub ProcessOneBug {
my $i = $_[0];
NewProcessOneBug($i);
# Make sure that everyone who was excluded because of the advanced
# filtering options (and thus are using new email tech) has the
# corresponding element in %seen set. This is so that they won't
# also be processed by the old email tech code, which follows.
#
# It's necessary because people who are excluded by the advanced
# filtering code never make it into NewProcessOnePerson(), which is
# where %seen would have otherwise been touched for them.
#
foreach my $person (@excludedAddresses) {
$seen{$person} = 1;
}
my $old = "shadow/$i";
my $new = "shadow/$i.tmp.$$";
my $diffs = "shadow/$i.diffs.$$";
my $verb = "Changed";
if (!stat($old)) {
mkdir "shadow", 0777;
chmod 0777, "shadow";
open(OLD, ">$old") || die "Couldn't create null $old";
close OLD;
$verb = "New";
}
my $text = GetBugText($i);
if ($text eq "") {
die "Couldn't find bug $i.";
}
open(FID, ">$new") || die "Couldn't create $new";
print FID $text;
close FID;
if (Different($old, $new)) {
system("diff -c -b $old $new > $diffs");
my $tolist = fixaddresses("to",
[$::bug{'assigned_to'}, $::bug{'reporter'},
$::bug{'qa_contact'}]);
my @combinedcc;
foreach my $v (split(/,/, "$::bug{'cclist'},$::bug{'voterlist'}")) {
push @combinedcc, $v;
}
push (@combinedcc, (@{$force{'CClist'}}, @{$force{'QAcontact'}},
@{$force{'Reporter'}}, @{$force{'Owner'}}));
my $cclist = fixaddresses("cc", \@combinedcc);
my $logstr = "Bug $i $verb";
if ($tolist ne "" || $cclist ne "") {
my %substs;
$substs{"fullbugreport"} = $text; # added ability to include the full bug report
$substs{"to"} = $tolist;
$substs{"cc"} = $cclist;
$substs{"bugid"} = $i;
$substs{"diffs"} = "";
open(DIFFS, "<$diffs") || die "Can't open $diffs";
while (<DIFFS>) {
$substs{"diffs"} .= $_;
}
close DIFFS;
$substs{"neworchanged"} = ($verb eq "New") ? "New: " : "";
$substs{"summary"} = $::bug{'short_desc'};
my $msg = PerformSubsts(Param("changedmail"), \%substs);
if (!$regenerate) {
# Note: fixaddresses may result in a Cc: only. This seems
# harmless.
my $sendmailparam = "-ODeliveryMode=deferred";
if (Param("sendmailnow")) {
$sendmailparam = "";
}
if ($enableSendMail==1) {
open(SENDMAIL,
"|/usr/lib/sendmail $sendmailparam -t") ||
die "Can't open sendmail";
print SENDMAIL $msg;
close SENDMAIL;
}
foreach my $n (split(/[, ]+/, "$tolist,$cclist")) {
if ($n ne "") {
push(@sentlist, $n);
}
}
$logstr = "$logstr; mail sent to $tolist, $cclist";
}
}
unlink($diffs);
Log($logstr);
}
# on the off chance that there are duplicate addresses in the exclude list,
# we filter it for dups one more time. They could have gotten there in
# fixaddresses(), NewProcessOnePerson(), or NewProcessOneBug.
#
@excludedAddresses = filterExcludeList(\@excludedAddresses,
\@sentlist);
if (!$regenerate) {
if (@sentlist) {
print "<B>Email sent to:</B> " . join(", ", @sentlist) . "<br>\n";
} else {
print "<B>Email sent to:</B> no one<br>\n";
}
if ( @excludedAddresses ) {
print "<br><B>Excluding: </B>" . join(", ", @excludedAddresses) .
"\n";
}
print "<br><br><center>New: <a href=\"userprefs.cgi\?bank=diffs\">" .
"change your email preferences<\/a> if you wish to tweak the " .
"kinds of Bugzilla email you get.<\/center>\n";
}
rename($new, $old) || die "Can't rename $new to $old";
chmod 0666, $old;
if ($regenerate) {
print "$i ";
}
%seen = ();
@sentlist = ();
}
# Code starts here # Code starts here
ConnectToDatabase(); ConnectToDatabase();
GetVersionTable(); GetVersionTable();
Lock();
if (open(FID, "<data/nomail")) { if (open(FID, "<data/nomail")) {
while (<FID>) { while (<FID>) {
$::nomail{trim($_)} = 1; $nomail{trim($_)} = 1;
} }
close FID; close FID;
} }
# To recreate the shadow database, run "processmail regenerate" .
if ($#ARGV >= 0 && $ARGV[0] eq "regenerate") { if ($#ARGV >= 0 && $ARGV[0] eq "regenerate") {
$regenerate = 1; print "Regenerating is no longer required or supported\n";
shift @ARGV;
SendSQL("select bug_id from bugs order by bug_id");
my @regenerate_list;
while (my @row = FetchSQLData()) {
push @regenerate_list, $row[0];
}
foreach my $i (@regenerate_list) {
ProcessOneBug($i);
Unlock();
Lock();
}
print("\n");
exit; exit;
} }
...@@ -1190,7 +739,7 @@ if ($#ARGV >= 0 && $ARGV[0] eq "-forceqacontact") { ...@@ -1190,7 +739,7 @@ if ($#ARGV >= 0 && $ARGV[0] eq "-forceqacontact") {
if (($#ARGV < 0) || ($#ARGV > 1)) { if (($#ARGV < 0) || ($#ARGV > 1)) {
print "Usage:\n processmail {bugid} {nametoexclude} " . print "Usage:\n processmail {bugid} {nametoexclude} " .
"[-forcecc list,of,users]\n [-forceowner name] " . "[-forcecc list,of,users]\n [-forceowner name] " .
"[-forceqacontact name]\nor\n processmail regenerate\nor\n" . "[-forceqacontact name]\nor\n" .
" processmail rescanall\n"; " processmail rescanall\n";
exit; exit;
} }
......
...@@ -61,6 +61,7 @@ my @emailFlags = ( ...@@ -61,6 +61,7 @@ my @emailFlags = (
); );
my $defaultEmailFlagString = my $defaultEmailFlagString =
'ExcludeSelf~' . 'on~' .
'emailOwnerRemoveme~' . 'on~' . 'emailOwnerRemoveme~' . 'on~' .
'emailOwnerComments~' . 'on~' . 'emailOwnerComments~' . 'on~' .
...@@ -180,79 +181,7 @@ sub setEmailFlags ($) { ...@@ -180,79 +181,7 @@ sub setEmailFlags ($) {
sub ShowEmailOptions () { sub ShowEmailOptions () {
SendSQL("SELECT emailnotification, newemailtech FROM profiles " . if (Param("supportwatchers")) {
"WHERE userid = $userid");
my ($emailnotification, $dbNewEmailTech) = (FetchSQLData());
# Override the database value with the current form value
# if the disable/enable button has been pressed.
if ( defined $::FORM{'newEmailTech'} ) {
# If the user has clicked on 'Disable New Email Tech',
# clear out their email flag preferences.
if ($dbNewEmailTech == 1) {
setEmailFlags('');
}
$showNewEmailTech = $::FORM{'newEmailTech'};
} else {
$showNewEmailTech = $dbNewEmailTech;
}
#print "<BR>database newemailtech = $showNewEmailTech<br>";
my $qacontactpart = "";
if (Param('useqacontact')) {
$qacontactpart = ", the current QA Contact";
}
if ($showNewEmailTech==0) {
print <<"--endquote--";
<TABLE>
<TR><TD COLSPAN="2">
Bugzilla will send out email notification of changed bugs to
the current owner, the Reporter of the bug$qacontactpart, and anyone on the
CC list. However, you can suppress some of those email notifications.
On which of these bugs would you like email notification of changes?
</TD></TR>
--endquote--
my $entry =
BuildPulldown("emailnotification",
[["ExcludeSelfChanges",
"All qualifying bugs except those which I change"],
["CConly",
"Only those bugs which I am listed on the CC line"],
["All",
"All qualifying bugs"]],
$emailnotification);
EmitEntry("Notify me of changes to", $entry);
print "</TABLE>";
}
if (Param("newemailtech")) {
print qq{
<TR><TD COLSPAN="2"><HR></TD></TR>
<TR><TD COLSPAN="2"><FONT COLOR="red">Updated!</FONT>
Bugzilla's new standard email notification scheme allows for the use of
features such as watching other users and selecting which bug changes you get
mail about. Although it's still possible to use the old notification scheme,
this isn't recommended, because the old scheme is no longer
supported and will be going away in an upcoming version of Bugzilla.
<FONT COLOR="red">Note that after clicking the link below, you must still click
on the <B>Submit Changes</B> button in order for your email tech change to be saved.</FONT>
</TD></TR>};
if ($showNewEmailTech == 1) {
print qq{
<tr><td colspan=2><center>
<A HREF="userprefs.cgi?bank=diffs&amp;newEmailTech=0">Disable New Email Tech</A>
</center></td></tr>};
} else {
print qq{<tr><td colspan=2><center><A HREF="userprefs.cgi?bank=diffs&amp;newEmailTech=1">Enable New Email Tech</A></center></td></tr>};
}
if (Param("supportwatchers") && $showNewEmailTech == 1) {
my $watcheduserSet = new RelationSet; my $watcheduserSet = new RelationSet;
$watcheduserSet->mergeFromDB("SELECT watched FROM watch WHERE" . $watcheduserSet->mergeFromDB("SELECT watched FROM watch WHERE" .
" watcher=$userid"); " watcher=$userid");
...@@ -261,7 +190,7 @@ on the <B>Submit Changes</B> button in order for your email tech change to be sa ...@@ -261,7 +190,7 @@ on the <B>Submit Changes</B> button in order for your email tech change to be sa
print qq{ print qq{
<TR><TD COLSPAN="4"><HR></TD></TR> <TR><TD COLSPAN="4"><HR></TD></TR>
<TR><TD COLSPAN="4"> <TR><TD COLSPAN="4">
<FONT COLOR="red">New Email Tech Feature: </FONT>If you want to help cover for someone when they're on vacation, or if If you want to help cover for someone when they're on vacation, or if
you need to do the QA related to all of their bugs, you can tell bugzilla you need to do the QA related to all of their bugs, you can tell bugzilla
to send mail related to their bugs to you also. List the email addresses to send mail related to their bugs to you also. List the email addresses
of any users you wish to watch here, separated by commas. of any users you wish to watch here, separated by commas.
...@@ -273,10 +202,7 @@ of any users you wish to watch here, separated by commas. ...@@ -273,10 +202,7 @@ of any users you wish to watch here, separated by commas.
print qq{<TR><TD COLSPAN="2"><HR></TD></TR>}; print qq{<TR><TD COLSPAN="2"><HR></TD></TR>};
if ($showNewEmailTech == 1) {
showAdvancedEmailFilterOptions(); showAdvancedEmailFilterOptions();
}
}
print qq { print qq {
<TABLE CELLSPACING="0" CELLPADDING="10" BORDER=0 WIDTH="100%"> <TABLE CELLSPACING="0" CELLPADDING="10" BORDER=0 WIDTH="100%">
...@@ -296,38 +222,25 @@ sub showAdvancedEmailFilterOptions () { ...@@ -296,38 +222,25 @@ sub showAdvancedEmailFilterOptions () {
</center> </center>
</TD></TR><tr><td colspan="2"> </TD></TR><tr><td colspan="2">
<p> <p>
<center><FONT COLOR="red">New Email Tech Feature:</FONT> <center>
Filter email notifications for <b>modified</b> If you don't like getting a notification for "trivial"
bugs (does not effect new bug email notices). changes to bugs, you can use the settings below to
filter some (or even all) notifications.
</center></td></tr></table> </center></td></tr></table>
<hr width=800 align=center> <hr width=800 align=center>
}; };
SendSQL("SELECT emailflags, emailnotification FROM profiles WHERE " . SendSQL("SELECT emailflags FROM profiles WHERE userid = $userid");
"userid = $userid");
($flags, $notify) = FetchSQLData(); ($flags) = FetchSQLData();
# if the emailflags haven't been set before, that means that this user # if the emailflags haven't been set before, that means that this user
# hasn't been to (the email pane of?) userprefs.cgi since the change to # hasn't been to (the email pane of?) userprefs.cgi since the change to
# use emailflags. create a default flagset for them, mostly based on # use emailflags. create a default flagset for them, based on
# static defaults, but setting ExcludeSelf based on the old # static defaults.
# emailnotification column.
# #
if ( !$flags ) { if ( !$flags ) {
$flags = $defaultEmailFlagString;
if ( !$notify ) {
confess("neither \$flags nor \$notify was set");
}
my $notifyString;
if ( $notify eq 'ExcludeSelfChanges' ) {
$notifyString = "ExcludeSelf~on~";
} else {
$notifyString = "ExcludeSelf~~";
}
$flags = $notifyString . $defaultEmailFlagString;
setEmailFlags($flags); setEmailFlags($flags);
} }
...@@ -440,13 +353,6 @@ sub SaveEmailOptions () { ...@@ -440,13 +353,6 @@ sub SaveEmailOptions () {
my $useNewEmailTech = $::FORM{'savedEmailTech'}; my $useNewEmailTech = $::FORM{'savedEmailTech'};
my $updateString; my $updateString;
if ($useNewEmailTech == 0) {
# we force the NEW email filter entry to allow all email
# (empty string defaults to allowing all email).
$updateString = '';
} else {
if ( defined $::FORM{'ExcludeSelf'}) { if ( defined $::FORM{'ExcludeSelf'}) {
$updateString .= 'ExcludeSelf~on'; $updateString .= 'ExcludeSelf~on';
} else { } else {
...@@ -473,19 +379,10 @@ sub SaveEmailOptions () { ...@@ -473,19 +379,10 @@ sub SaveEmailOptions () {
} }
} }
# we force the OLD email tech flag to allow all email
$::FORM{'emailnotification'} = "All";
}
#open(FID,">updateString"); #open(FID,">updateString");
#print qq{UPDATE STRING: $updateString <br>}; #print qq{UPDATE STRING: $updateString <br>};
#close(FID); #close(FID);
SendSQL("UPDATE profiles SET emailnotification = "
. SqlQuote($::FORM{'emailnotification'})
. ", newemailtech = $useNewEmailTech "
. "WHERE userid = $userid" );
SendSQL("UPDATE profiles SET emailflags = " . SendSQL("UPDATE profiles SET emailflags = " .
SqlQuote($updateString) . " WHERE userid = $userid"); SqlQuote($updateString) . " WHERE userid = $userid");
...@@ -493,9 +390,6 @@ sub SaveEmailOptions () { ...@@ -493,9 +390,6 @@ sub SaveEmailOptions () {
if (exists $::FORM{'watchedusers'}) { if (exists $::FORM{'watchedusers'}) {
Error ('You must have "New email tech" set to watch someone')
if ( $::FORM{'watchedusers'} ne "" && $useNewEmailTech == 0);
# Just in case. Note that this much locking is actually overkill: # Just in case. Note that this much locking is actually overkill:
# we don't really care if anyone reads the watch table. So # we don't really care if anyone reads the watch table. So
# some small amount of contention could be gotten rid of by # some small amount of contention could be gotten rid of by
......
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