summaryrefslogtreecommitdiffstats
path: root/sanitycheck.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-12-14 05:41:24 +0100
committerlpsolit%gmail.com <>2005-12-14 05:41:24 +0100
commit0363ddf363d4742fc4e65ef1d461ec53d73342c5 (patch)
treee4aeed9dfe425d7f0c09dd5e9384b54fb099c7ae /sanitycheck.cgi
parent5107efb51fdeac3b9167d010141cd4bb5482c10a (diff)
downloadbugzilla-0363ddf363d4742fc4e65ef1d461ec53d73342c5.tar.gz
bugzilla-0363ddf363d4742fc4e65ef1d461ec53d73342c5.tar.xz
Bug 299653: sanitycheck.cgi should catch missing bugs.creation_ts - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wurblzap a=justdave
Diffstat (limited to 'sanitycheck.cgi')
-rwxr-xr-xsanitycheck.cgi31
1 files changed, 31 insertions, 0 deletions
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index 902832300..eeb45902f 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -188,6 +188,32 @@ if (defined $cgi->param('createmissinggroupcontrolmapentries')) {
}
###########################################################################
+# Fix missing creation date
+###########################################################################
+
+if (defined $cgi->param('repair_creation_date')) {
+ Status("OK, now fixing missing bug creation dates");
+
+ my $bug_ids = $dbh->selectcol_arrayref('SELECT bug_id FROM bugs
+ WHERE creation_ts IS NULL');
+
+ my $sth_UpdateDate = $dbh->prepare('UPDATE bugs SET creation_ts = ?
+ WHERE bug_id = ?');
+
+ # All bugs have an entry in the 'longdescs' table when they are created,
+ # even if 'commentoncreate' is turned off.
+ my $sth_getDate = $dbh->prepare('SELECT MIN(bug_when) FROM longdescs
+ WHERE bug_id = ?');
+
+ foreach my $bugid (@$bug_ids) {
+ $sth_getDate->execute($bugid);
+ my $date = $sth_getDate->fetchrow_array;
+ $sth_UpdateDate->execute($date, $bugid);
+ }
+ Status(scalar(@$bug_ids) . " bugs have been fixed.");
+}
+
+###########################################################################
# Send unsent mail
###########################################################################
@@ -692,6 +718,11 @@ sub BugCheck {
}
}
+Status("Checking for bugs with no creation date (which makes them invisible)");
+
+BugCheck("bugs WHERE creation_ts IS NULL", "Bugs with no creation date",
+ "repair_creation_date", "Repair missing creation date for these bugs");
+
Status("Checking resolution/duplicates");
BugCheck("bugs INNER JOIN duplicates ON bugs.bug_id = duplicates.dupe " .