From 52076b7735d378df3ece24c3317372a21e6c6e3c Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 14 Dec 2005 04:45:17 +0000 Subject: [PATCH] =?utf8?q?Bug=20299653:=20sanitycheck.cgi=20should=20catch?= =?utf8?q?=20missing=20bugs.creation=5Fts=20-=20Patch=20by=20Fr=C3=A9d?= =?utf8?q?=C3=A9ric=20Buclin=20=20r=3Dwurblzap=20a=3Dju?= =?utf8?q?stdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- sanitycheck.cgi | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/sanitycheck.cgi b/sanitycheck.cgi index 8113eb703c..276abfd320 100755 --- a/sanitycheck.cgi +++ b/sanitycheck.cgi @@ -245,6 +245,32 @@ if (defined $cgi->param('createmissinggroupcontrolmapentries')) { Status("Repaired $counter defective group control settings."); } +########################################################################### +# 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 ########################################################################### @@ -752,6 +778,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 " . -- 2.47.2