]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 277723 : Add comments why checksetup uses slow code to check for spaces and comma...
authortravis%sedsystems.ca <>
Thu, 10 Feb 2005 01:21:31 +0000 (01:21 +0000)
committertravis%sedsystems.ca <>
Thu, 10 Feb 2005 01:21:31 +0000 (01:21 +0000)
Patch by Nick.Barnes@pobox.com  r=wurblzap by inspection   a=justdave

checksetup.pl

index 5201d1dc40eedf227b8969b2f2423f70ae772ec5..eb34ec6681ea21ac13cb663b6111bc09e79259b9 100755 (executable)
@@ -3781,17 +3781,19 @@ if (TableExists("attachstatuses") && TableExists("attachstatusdefs")) {
 
     print "done.\n";
 }
-
 # 2004-12-13 Nick.Barnes@pobox.com bug 262268
 # Check flag type names for spaces and commas, and rename them.
 if (TableExists("flagtypes")) {
-    # Get names and IDs which are broken.
+    # Get all names and IDs, to find broken ones and to
+    # check for collisions when renaming.
     $sth = $dbh->prepare("SELECT name, id FROM flagtypes");
     $sth->execute();
 
     my %flagtypes;
     my @badflagnames;
     
+    # find broken flagtype names, and populate a hash table
+    # to check for collisions.
     while (my ($name, $id) = $sth->fetchrow_array()) {
         $flagtypes{$name} = $id;
         if ($name =~ /[ ,]/) {
@@ -3804,7 +3806,9 @@ if (TableExists("flagtypes")) {
         my $sth = $dbh->prepare("UPDATE flagtypes SET name = ? WHERE id = ?");
         foreach $flagname (@badflagnames) {
             print "  Bad flag type name \"$flagname\" ...\n";
+            # find a new name for this flagtype.
             ($tryflagname = $flagname) =~ tr/ ,/__/;
+            # avoid collisions with existing flagtype names.
             while (defined($flagtypes{$tryflagname})) {
                 print "  ... can't rename as \"$tryflagname\" ...\n";
                 $tryflagname .= "'";