]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 452893: request.cgi crashes if a flag modification date is invalid - Patch by...
authorlpsolit%gmail.com <>
Wed, 10 Sep 2008 15:41:36 +0000 (15:41 +0000)
committerlpsolit%gmail.com <>
Wed, 10 Sep 2008 15:41:36 +0000 (15:41 +0000)
Bugzilla/Install/DB.pm

index 218ea093fadf1f255f29af47b31e5ba8725c1cf3..213fe30997876b31bcdfa524c5fa9baf4baf2352 100644 (file)
@@ -532,7 +532,10 @@ sub update_table_definitions {
     # 2008-07-28 tfu@redhat.com - Bug 431669
     $dbh->bz_alter_column('group_control_map', 'product_id',
         { TYPE => 'INT2', NOTNULL => 1 });
-    
+
+    # 2008-09-07 LpSolit@gmail.com - Bug 452893
+    _fix_illegal_flag_modification_dates();
+
     ################################################################
     # New --TABLE-- changes should go *** A B O V E *** this point #
     ################################################################
@@ -3083,6 +3086,15 @@ sub _populate_bugs_fulltext {
     }
 }
 
+sub _fix_illegal_flag_modification_dates {
+    my $dbh = Bugzilla->dbh;
+
+    my $rows = $dbh->do('UPDATE flags SET modification_date = creation_date
+                         WHERE modification_date < creation_date');
+    # If no rows are affected, $dbh->do returns 0E0 instead of 0.
+    print "$rows flags had an illegal modification date. Fixed!\n" if ($rows =~ /^\d+$/);
+}
+
 1;
 
 __END__