summaryrefslogtreecommitdiffstats
path: root/collectstats.pl
diff options
context:
space:
mode:
authorjustdave%syndicomm.com <>2001-04-07 03:19:44 +0200
committerjustdave%syndicomm.com <>2001-04-07 03:19:44 +0200
commit6ed055cfc3fb1f7821fdfbccbda100a489f57ffa (patch)
tree3ac41f59af043caf91c74107fa83f996d6f5d5b6 /collectstats.pl
parent9818692e383d603ed728df6c16c02150854b6d3c (diff)
downloadbugzilla-6ed055cfc3fb1f7821fdfbccbda100a489f57ffa.tar.gz
bugzilla-6ed055cfc3fb1f7821fdfbccbda100a489f57ffa.tar.xz
Fix for bug 72721 (duplicates.cgi performs poorly with lots of bugs) and bug 69054 (DB_File not portable): dependence on DB_File removed, now uses AnyDBM_File which comes standard with Perl. Duplicates.cgi now runs its queries against the shadow database if it's available, among many other improvements.
Patch by gervase.markham@univ.ox.ac.uk (Gervase Markham) r= justdave
Diffstat (limited to 'collectstats.pl')
-rwxr-xr-xcollectstats.pl15
1 files changed, 10 insertions, 5 deletions
diff --git a/collectstats.pl b/collectstats.pl
index e645165e1..d6a97e4e2 100755
--- a/collectstats.pl
+++ b/collectstats.pl
@@ -24,7 +24,7 @@
# Run me out of cron at midnight to collect Bugzilla statistics.
-use DB_File;
+use AnyDBM_File;
use diagnostics;
use strict;
use vars @::legal_product;
@@ -125,16 +125,16 @@ sub calculate_dupes {
my $key;
my $changed = 1;
- my $today = &today;
+ my $today = &today_dash;
# Save % count here in a date-named file
# so we can read it back in to do changed counters
# First, delete it if it exists, so we don't add to the contents of an old file
- if (-e "data/mining/dupes$today.db") {
- system("rm -f data/mining/dupes$today.db");
+ if (-e "data/mining/dupes$today") {
+ system("rm -f data/mining/dupes$today");
}
- dbmopen(%count, "data/mining/dupes$today.db", 0644) || die "Can't open DBM dupes file: $!";
+ dbmopen(%count, "data/mining/dupes$today", 0644) || die "Can't open DBM dupes file: $!";
# Create a hash with key "a bug number", value "bug which that bug is a
# direct dupe of" - straight from the duplicates table.
@@ -194,3 +194,8 @@ sub today {
return sprintf "%04d%02d%02d", 1900 + $year, ++$mon, $dom;
}
+sub today_dash {
+ my ($dom, $mon, $year) = (localtime(time))[3, 4, 5];
+ return sprintf "%04d-%02d-%02d", 1900 + $year, ++$mon, $dom;
+}
+