summaryrefslogtreecommitdiffstats
path: root/checksetup.pl
diff options
context:
space:
mode:
authortara%tequilarista.org <>2000-10-24 07:01:30 +0200
committertara%tequilarista.org <>2000-10-24 07:01:30 +0200
commitac3b5ab852234a4fd6a09030fb259c1c6d236dd4 (patch)
treec4ea3b3e21f9f9b428ce75d3a471cf8f7b778c95 /checksetup.pl
parentcf9b879f29f0d01c93882cc40f6c1ce63d870efc (diff)
downloadbugzilla-ac3b5ab852234a4fd6a09030fb259c1c6d236dd4.tar.gz
bugzilla-ac3b5ab852234a4fd6a09030fb259c1c6d236dd4.tar.xz
Landing duplicates stuff from gervase markham
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-xchecksetup.pl45
1 files changed, 44 insertions, 1 deletions
diff --git a/checksetup.pl b/checksetup.pl
index 6f9fe1c1b..f978f8600 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -835,9 +835,12 @@ $table{shadowlog} =
ts timestamp,
reflected tinyint not null,
command mediumtext not null,
-
index(reflected)';
+# GRM
+$table{duplicates} =
+ 'dupe_of mediumint(9) not null,
+ dupe mediumint(9) not null primary key';
###########################################################################
@@ -1745,6 +1748,46 @@ if ( CountIndexes('keywords') != 3 ) {
}
+# 2000-07-15 Added duplicates table so Bugzilla tracks duplicates in a better
+# way than it used to. This code searches the comments to populate the table
+# initially. It's executed if the table is empty; if it's empty because there
+# are no dupes (as opposed to having just created the table) it won't have
+# any effect anyway, so it doesn't matter.
+
+# This should give us the number of populated rows but seems to return "5"
+# all the time <shrug>
+$dbh->prepare("SELECT * FROM duplicates");
+$sth->execute();
+
+if ($sth->fetchrow_array() == 5)
+{
+ # populate table
+ print("Populating duplicates table...\n");
+
+ $sth = $dbh->prepare("SELECT longdescs.bug_id, thetext FROM longdescs left JOIN bugs using(bug_id) WHERE (thetext " .
+ "regexp 'This bug has been marked as a duplicate of') AND (resolution = 'DUPLICATE') ORDER" .
+ " BY longdescs.bug_when");
+ $sth->execute();
+
+ my %dupes;
+ my $key;
+
+ # Because of the way hashes work, this loop removes all but the last dupe
+ # resolution found for a given bug.
+ while (my ($dupe, $dupe_of) = $sth->fetchrow_array()) {
+ $dupes{$dupe} = $dupe_of;
+ }
+
+ foreach $key (keys(%dupes))
+ {
+ $dupes{$key} =~ s/.*This bug has been marked as a duplicate of (\d{1,5}).*/$1/;
+ $dbh->do("INSERT INTO duplicates VALUES('$dupes{$key}', '$key')");
+ # BugItsADupeOf Dupe
+ }
+
+ $regenerateshadow = 1;
+}
+
#
# If you had to change the --TABLE-- definition in any way, then add your
# differential change code *** A B O V E *** this comment.