From: lpsolit%gmail.com <> Date: Wed, 14 Dec 2005 04:57:20 +0000 (+0000) Subject: Bug 299653: sanitycheck.cgi should catch missing bugs.creation_ts - Patch by Frédéric... X-Git-Tag: bugzilla-2.18.5~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61eeddfbb1696ebf25e313dd091bb1d1d17d3bc4;p=thirdparty%2Fbugzilla.git Bug 299653: sanitycheck.cgi should catch missing bugs.creation_ts - Patch by Frédéric Buclin r=wurblzap a=justdave --- diff --git a/sanitycheck.cgi b/sanitycheck.cgi index de0a879ab0..aeabda67d0 100755 --- a/sanitycheck.cgi +++ b/sanitycheck.cgi @@ -237,6 +237,36 @@ 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 +########################################################################### + if (defined $cgi->param('rescanallBugMail')) { require Bugzilla::BugMail; @@ -687,6 +717,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, duplicates WHERE " .