summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/BugMail.pm3
-rw-r--r--CGI.pl15
-rwxr-xr-xattachment.cgi2
-rwxr-xr-xchecksetup.pl9
-rwxr-xr-xcontrib/bug_email.pl6
-rw-r--r--contrib/jb2bz.py2
-rwxr-xr-xeditmilestones.cgi3
-rwxr-xr-xeditproducts.cgi16
-rwxr-xr-xeditversions.cgi3
-rw-r--r--globals.pl5
-rwxr-xr-ximportxml.pl10
-rwxr-xr-xmove.pl6
-rwxr-xr-xpost_bug.cgi16
-rwxr-xr-xprocess_bug.cgi15
-rwxr-xr-xsanitycheck.cgi7
-rwxr-xr-xvotes.cgi3
16 files changed, 51 insertions, 70 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index 9df905f32..6b77f6d94 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -415,7 +415,8 @@ sub ProcessOneBug($) {
}
- SendSQL("UPDATE bugs SET lastdiffed = '$end' WHERE bug_id = $id");
+ SendSQL("UPDATE bugs SET lastdiffed = '$end', delta_ts = delta_ts " .
+ "WHERE bug_id = $id");
# Filter the exclude list for dupes one last time
@excludedAddresses = filterExcludeList(\@excludedAddresses,
diff --git a/CGI.pl b/CGI.pl
index 4d7b34047..165e5216c 100644
--- a/CGI.pl
+++ b/CGI.pl
@@ -246,28 +246,27 @@ sub CheckIfVotedConfirmed {
my ($id, $who) = (@_);
PushGlobalSQLState();
SendSQL("SELECT bugs.votes, bugs.bug_status, products.votestoconfirm, " .
- " bugs.everconfirmed, NOW() " .
+ " bugs.everconfirmed " .
"FROM bugs, products " .
"WHERE bugs.bug_id = $id AND products.id = bugs.product_id");
- my ($votes, $status, $votestoconfirm, $everconfirmed, $now) = (FetchSQLData());
+ my ($votes, $status, $votestoconfirm, $everconfirmed) = (FetchSQLData());
my $ret = 0;
if ($votes >= $votestoconfirm && $status eq $::unconfirmedstate) {
- SendSQL("UPDATE bugs SET bug_status = 'NEW', everconfirmed = 1, " .
- "delta_ts = $now WHERE bug_id = $id");
+ SendSQL("UPDATE bugs SET bug_status = 'NEW', everconfirmed = 1 " .
+ "WHERE bug_id = $id");
my $fieldid = GetFieldID("bug_status");
SendSQL("INSERT INTO bugs_activity " .
"(bug_id,who,bug_when,fieldid,removed,added) VALUES " .
- "($id,$who,$now,$fieldid,'$::unconfirmedstate','NEW')");
+ "($id,$who,now(),$fieldid,'$::unconfirmedstate','NEW')");
if (!$everconfirmed) {
$fieldid = GetFieldID("everconfirmed");
SendSQL("INSERT INTO bugs_activity " .
"(bug_id,who,bug_when,fieldid,removed,added) VALUES " .
- "($id,$who,$now,$fieldid,'0','1')");
+ "($id,$who,now(),$fieldid,'0','1')");
}
AppendComment($id, DBID_to_name($who),
- "*** This bug has been confirmed by popular vote. ***",
- 0, $now);
+ "*** This bug has been confirmed by popular vote. ***", 0);
$vars->{'type'} = "votes";
$vars->{'id'} = $id;
diff --git a/attachment.cgi b/attachment.cgi
index a5407e8b0..202c8818f 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -940,7 +940,7 @@ sub insert
@newvalues = map(SqlQuote($_), @newvalues);
# Update the bug record. Note that this doesn't involve login_name.
- SendSQL("UPDATE bugs SET delta_ts = $sql_timestamp, " .
+ SendSQL("UPDATE bugs SET " .
join(", ", map("$fields[$_] = $newvalues[$_]", (0..2))) .
" WHERE bug_id = $::FORM{'bugid'}");
diff --git a/checksetup.pl b/checksetup.pl
index d03646dcf..6bbedaaea 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -1753,7 +1753,7 @@ $table{bugs} =
bug_severity enum($my_severities) not null,
bug_status enum("UNCONFIRMED", "NEW", "ASSIGNED", "REOPENED", "RESOLVED", "VERIFIED", "CLOSED") not null,
creation_ts datetime not null,
- delta_ts datetime not null,
+ delta_ts timestamp not null,
short_desc mediumtext not null,
op_sys enum($my_opsys) not null,
priority enum($my_priorities) not null,
@@ -4689,13 +4689,6 @@ if ($emptygroupid) {
print "Group $emptygroupid had an empty name; renamed as '$trygroupname'.\n";
}
-# 2005-01-17 - Tomas.Kopal@altap.cz, bug 257315
-# Change bugs.delta_ts type from timestamp to datetime
-if (($fielddef = GetFieldDef("bugs", "delta_ts")) &&
- $fielddef->[1] =~ /^timestamp/) {
- ChangeFieldType ('bugs', 'delta_ts', 'DATETIME NOT NULL');
-}
-
#
# Final checks...
diff --git a/contrib/bug_email.pl b/contrib/bug_email.pl
index 6697c5d63..6589401e8 100755
--- a/contrib/bug_email.pl
+++ b/contrib/bug_email.pl
@@ -38,7 +38,7 @@
#
# You need to work with bug_email.pl the MIME::Parser installed.
#
-# $Id: bug_email.pl,v 1.21 2005/01/28 19:01:28 travis%sedsystems.ca Exp $
+# $Id: bug_email.pl,v 1.22 2005/01/30 04:22:28 justdave%bugzilla.org Exp $
###############################################################
# 02/12/2000 (SML)
@@ -1085,7 +1085,7 @@ END
my $reporter = "";
my $query = "insert into bugs (\n" . join(",\n", @used_fields ) .
- ", bug_status, creation_ts, delta_ts, everconfirmed) values ( ";
+ ", bug_status, creation_ts, everconfirmed) values ( ";
# 'Yuck'. Then again, this whole file should be rewritten anyway...
$query =~ s/product/product_id/;
@@ -1140,7 +1140,7 @@ END
$state = SqlQuote("NEW");
}
- $query .= $state . ", \'$bug_when\', \'$bug_when\', $ever_confirmed)\n";
+ $query .= $state . ", \'$bug_when\', $ever_confirmed)\n";
# $query .= SqlQuote( "NEW" ) . ", now(), " . SqlQuote($comment) . " )\n";
SendSQL("SELECT userid FROM profiles WHERE login_name=\'$reporter\'");
diff --git a/contrib/jb2bz.py b/contrib/jb2bz.py
index ed8231dfc..dbd47ea7a 100644
--- a/contrib/jb2bz.py
+++ b/contrib/jb2bz.py
@@ -208,7 +208,6 @@ def process_jitterbug(filename):
"bug_severity='normal'," \
"bug_status=%s," \
"creation_ts=%s," \
- "delta_ts=%s," \
"short_desc=%s," \
"product=%s," \
"rep_platform='All'," \
@@ -220,7 +219,6 @@ def process_jitterbug(filename):
[ current['number'],
bug_status,
time.strftime("%Y-%m-%d %H:%M:%S", current['date-reported'][:9]),
- time.strftime("%Y-%m-%d %H:%M:%S", current['date-reported'][:9]),
current['short-description'],
product,
reporter,
diff --git a/editmilestones.cgi b/editmilestones.cgi
index 6d47fc6af..160385104 100755
--- a/editmilestones.cgi
+++ b/editmilestones.cgi
@@ -548,7 +548,8 @@ if ($action eq 'update') {
trick_taint($milestoneold);
$dbh->do('UPDATE bugs
- SET target_milestone = ?
+ SET target_milestone = ?,
+ delta_ts = delta_ts
WHERE target_milestone = ?
AND product_id = ?',
undef,
diff --git a/editproducts.cgi b/editproducts.cgi
index b10a238fc..8fe1a5ec5 100755
--- a/editproducts.cgi
+++ b/editproducts.cgi
@@ -1176,12 +1176,12 @@ if ($action eq 'updategroupcontrols') {
my ($removed, $timestamp) = FetchSQLData();
LogActivityEntry($bugid, "bug_group", $removed, "",
$::userid, $timestamp);
- my $diffed = "";
if ($mailiscurrent != 0) {
- $diffed = ", lastdiffed = " . SqlQuote($timestamp);
+ SendSQL("UPDATE bugs SET lastdiffed = " . SqlQuote($timestamp)
+ . " WHERE bug_id = $bugid");
}
- SendSQL("UPDATE bugs SET delta_ts = " . SqlQuote($timestamp) .
- $diffed . " WHERE bug_id = $bugid");
+ SendSQL("UPDATE bugs SET delta_ts = " . SqlQuote($timestamp)
+ . " WHERE bug_id = $bugid");
PopGlobalSQLState();
$count++;
}
@@ -1210,12 +1210,12 @@ if ($action eq 'updategroupcontrols') {
my ($added, $timestamp) = FetchSQLData();
LogActivityEntry($bugid, "bug_group", "", $added,
$::userid, $timestamp);
- my $diffed = "";
if ($mailiscurrent != 0) {
- $diffed = ", lastdiffed = " . SqlQuote($timestamp);
+ SendSQL("UPDATE bugs SET lastdiffed = " . SqlQuote($timestamp)
+ . " WHERE bug_id = $bugid");
}
- SendSQL("UPDATE bugs SET delta_ts = " . SqlQuote($timestamp) .
- $diffed . " WHERE bug_id = $bugid");
+ SendSQL("UPDATE bugs SET delta_ts = " . SqlQuote($timestamp)
+ . " WHERE bug_id = $bugid");
PopGlobalSQLState();
$count++;
}
diff --git a/editversions.cgi b/editversions.cgi
index 2173470dc..e4cf47e2a 100755
--- a/editversions.cgi
+++ b/editversions.cgi
@@ -418,7 +418,8 @@ if ($action eq 'update') {
exit;
}
SendSQL("UPDATE bugs
- SET version=" . SqlQuote($version) . "
+ SET version=" . SqlQuote($version) . ",
+ delta_ts = delta_ts
WHERE version=" . SqlQuote($versionold) . "
AND product_id = $product_id");
SendSQL("UPDATE versions
diff --git a/globals.pl b/globals.pl
index 73f8ed82c..0c1ba852b 100644
--- a/globals.pl
+++ b/globals.pl
@@ -138,7 +138,7 @@ sub AppendComment {
"VALUES($bugid, $whoid, $timestamp, " . SqlQuote($comment) . ", " .
$privacyval . ", " . SqlQuote($work_time) . ")");
- SendSQL("UPDATE bugs SET delta_ts = $timestamp WHERE bug_id = $bugid");
+ SendSQL("UPDATE bugs SET delta_ts = now() WHERE bug_id = $bugid");
}
sub GetFieldID {
@@ -1420,7 +1420,8 @@ sub RemoveVotes {
SendSQL("SELECT SUM(vote_count) FROM votes WHERE bug_id = $id");
my $v = FetchOneColumn();
$v ||= 0;
- SendSQL("UPDATE bugs SET votes = $v WHERE bug_id = $id");
+ SendSQL("UPDATE bugs SET votes = $v, delta_ts = delta_ts " .
+ "WHERE bug_id = $id");
}
}
diff --git a/importxml.pl b/importxml.pl
index 21d962d41..277681a35 100755
--- a/importxml.pl
+++ b/importxml.pl
@@ -339,21 +339,13 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
my @query = ();
my @values = ();
- foreach my $field ( qw(creation_ts status_whiteboard) ) {
+ foreach my $field ( qw(creation_ts delta_ts status_whiteboard) ) {
if ( (defined $bug_fields{$field}) && ($bug_fields{$field}) ){
push (@query, "$field");
push (@values, SqlQuote($bug_fields{$field}));
}
}
- push (@query, "delta_ts");
- if ( (defined $bug_fields{'delta_ts'}) && ($bug_fields{'delta_ts'}) ){
- push (@values, SqlQuote($bug_fields{'delta_ts'}));
- }
- else {
- push (@values, "NOW()");
- }
-
if ( (defined $bug_fields{'bug_file_loc'}) && ($bug_fields{'bug_file_loc'}) ){
push (@query, "bug_file_loc");
push (@values, SqlQuote($bug_fields{'bug_file_loc'}));
diff --git a/move.pl b/move.pl
index 7747baaed..328671f81 100755
--- a/move.pl
+++ b/move.pl
@@ -122,10 +122,8 @@ foreach my $id (split(/:/, scalar($cgi->param('buglist')))) {
"(bug_id,who,bug_when,fieldid,removed,added) VALUES " .
"($id,$exporterid,now(),$fieldid,'$cur_res','MOVED')");
- SendSQL("UPDATE bugs SET bug_status =\"RESOLVED\",
- resolution =\"MOVED\",
- delta_ts = NOW()
- WHERE bug_id=\"$id\"");
+ SendSQL("UPDATE bugs SET bug_status =\"RESOLVED\" where bug_id=\"$id\"");
+ SendSQL("UPDATE bugs SET resolution =\"MOVED\" where bug_id=\"$id\"");
my $comment = "";
if (defined $cgi->param('comment') && $cgi->param('comment') !~ /^\s*$/) {
diff --git a/post_bug.cgi b/post_bug.cgi
index 112292171..40111ff77 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -321,14 +321,9 @@ if (UserInGroup("editbugs") && defined($::FORM{'dependson'})) {
}
}
-# get current time
-SendSQL("SELECT NOW()");
-my $timestamp = FetchOneColumn();
-
-
# Build up SQL string to add bug.
my $sql = "INSERT INTO bugs " .
- "(" . join(",", @used_fields) . ", reporter, creation_ts, delta_ts, " .
+ "(" . join(",", @used_fields) . ", reporter, creation_ts, " .
"estimated_time, remaining_time, deadline) " .
"VALUES (";
@@ -342,7 +337,7 @@ $comment = trim($comment);
# OK except for the fact that it causes e-mail to be suppressed.
$comment = $comment ? $comment : " ";
-$sql .= "$::userid, $timestamp, $timestamp, ";
+$sql .= "$::userid, now(), ";
# Time Tracking
if (UserInGroup(Param("timetrackinggroup")) &&
@@ -419,6 +414,9 @@ while (MoreSQLData()) {
# Add the bug report to the DB.
SendSQL($sql);
+SendSQL("select now()");
+my $timestamp = FetchOneColumn();
+
# Get the bug ID back.
SendSQL("select LAST_INSERT_ID()");
my $id = FetchOneColumn();
@@ -458,8 +456,8 @@ if (UserInGroup("editbugs")) {
while (MoreSQLData()) {
push (@list, FetchOneColumn());
}
- SendSQL("UPDATE bugs SET delta_ts = $timestamp," .
- " keywords = " . SqlQuote(join(', ', @list)) .
+ SendSQL("UPDATE bugs SET keywords = " .
+ SqlQuote(join(', ', @list)) .
" WHERE bug_id = $id");
}
if (defined $::FORM{'dependson'}) {
diff --git a/process_bug.cgi b/process_bug.cgi
index ecf4d80b9..78423ab3d 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -1112,14 +1112,14 @@ sub FindWrapPoint {
}
sub LogDependencyActivity {
- my ($i, $oldstr, $target, $me, $timestamp) = (@_);
+ my ($i, $oldstr, $target, $me) = (@_);
my $newstr = SnapShotDeps($i, $target, $me);
if ($oldstr ne $newstr) {
# Figure out what's really different...
my ($removed, $added) = diff_strings($oldstr, $newstr);
LogActivityEntry($i,$target,$removed,$added,$whoid,$timestamp);
# update timestamp on target bug so midairs will be triggered
- SendSQL("UPDATE bugs SET delta_ts=$timestamp WHERE bug_id=$i");
+ SendSQL("UPDATE bugs SET delta_ts=NOW() WHERE bug_id=$i");
$bug_changed = 1;
return 1;
}
@@ -1403,7 +1403,7 @@ foreach my $id (@idlist) {
while (MoreSQLData()) {
push(@list, FetchOneColumn());
}
- SendSQL("UPDATE bugs SET delta_ts = $timestamp, keywords = " .
+ SendSQL("UPDATE bugs SET keywords = " .
SqlQuote(join(', ', @list)) .
" WHERE bug_id = $id");
}
@@ -1558,9 +1558,9 @@ foreach my $id (@idlist) {
SendSQL("insert into dependencies ($me, $target) values ($id, $i)");
}
foreach my $k (@keys) {
- LogDependencyActivity($k, $snapshot{$k}, $me, $target, $timestamp);
+ LogDependencyActivity($k, $snapshot{$k}, $me, $target);
}
- LogDependencyActivity($id, $oldsnap, $target, $me, $timestamp);
+ LogDependencyActivity($id, $oldsnap, $target, $me);
$check_dep_bugs = 1;
}
@@ -1804,10 +1804,7 @@ foreach my $id (@idlist) {
SendSQL("INSERT INTO cc (who, bug_id) VALUES ($reporter, " . SqlQuote($duplicate) . ")");
}
# Bug 171639 - Duplicate notifications do not need to be private.
- AppendComment($duplicate, Bugzilla->user->login,
- "*** Bug $::FORM{'id'} has been marked as a duplicate of this bug. ***",
- 0, $timestamp);
-
+ AppendComment($duplicate, Bugzilla->user->login, "*** Bug $::FORM{'id'} has been marked as a duplicate of this bug. ***", 0);
CheckFormFieldDefined(\%::FORM,'comment');
SendSQL("INSERT INTO duplicates VALUES ($duplicate, $::FORM{'id'})");
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index 7de0d92ae..4db4e0192 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -98,7 +98,7 @@ PutHeader("Bugzilla Sanity Check");
if (defined $cgi->param('rebuildvotecache')) {
Status("OK, now rebuilding vote cache.");
SendSQL("LOCK TABLES bugs WRITE, votes READ");
- SendSQL("UPDATE bugs SET votes = 0");
+ SendSQL("UPDATE bugs SET votes = 0, delta_ts = delta_ts");
SendSQL("SELECT bug_id, SUM(vote_count) FROM votes GROUP BY bug_id");
my %votes;
while (@row = FetchSQLData()) {
@@ -106,7 +106,7 @@ if (defined $cgi->param('rebuildvotecache')) {
$votes{$id} = $v;
}
foreach my $id (keys %votes) {
- SendSQL("UPDATE bugs SET votes = $votes{$id} WHERE bug_id = $id");
+ SendSQL("UPDATE bugs SET votes = $votes{$id}, delta_ts = delta_ts WHERE bug_id = $id");
}
SendSQL("UNLOCK TABLES");
Status("Vote cache has been rebuilt.");
@@ -588,7 +588,8 @@ if (@badbugs) {
if (exists($realk{$b})) {
$k = $realk{$b};
}
- SendSQL("UPDATE bugs SET keywords = " . SqlQuote($k) .
+ SendSQL("UPDATE bugs SET delta_ts = delta_ts, keywords = " .
+ SqlQuote($k) .
" WHERE bug_id = $b");
}
Status("Keyword cache fixed.");
diff --git a/votes.cgi b/votes.cgi
index e209ba338..49ac0cb2a 100755
--- a/votes.cgi
+++ b/votes.cgi
@@ -343,7 +343,8 @@ sub record_votes {
foreach my $id (keys %affected) {
SendSQL("SELECT sum(vote_count) FROM votes WHERE bug_id = $id");
my $v = FetchOneColumn() || 0;
- SendSQL("UPDATE bugs SET votes = $v WHERE bug_id = $id");
+ SendSQL("UPDATE bugs SET votes = $v, delta_ts=delta_ts
+ WHERE bug_id = $id");
my $confirmed = CheckIfVotedConfirmed($id, $who);
$vars->{'header_done'} = 1 if $confirmed;
}