summaryrefslogtreecommitdiffstats
path: root/checksetup.pl
diff options
context:
space:
mode:
authortravis%sedsystems.ca <>2005-02-10 02:20:22 +0100
committertravis%sedsystems.ca <>2005-02-10 02:20:22 +0100
commit6a20f783538986e8caf60b31a659248dd552f63f (patch)
tree1fd275210e1efb7ec80d87721b5cba284649f026 /checksetup.pl
parente564c92b745326a96a74f03eebb4dfd738de03cf (diff)
downloadbugzilla-6a20f783538986e8caf60b31a659248dd552f63f.tar.gz
bugzilla-6a20f783538986e8caf60b31a659248dd552f63f.tar.xz
Bug 277723 : Add comments why checksetup uses slow code to check for spaces and commas in flags
Patch by Nick.Barnes@pobox.com r=wurblzap by inspection a=justdave
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-xchecksetup.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/checksetup.pl b/checksetup.pl
index 409568b83..e79598029 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -3906,17 +3906,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 =~ /[ ,]/) {
@@ -3929,7 +3931,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 .= "'";