From 6ed055cfc3fb1f7821fdfbccbda100a489f57ffa Mon Sep 17 00:00:00 2001 From: "justdave%syndicomm.com" <> Date: Sat, 7 Apr 2001 01:19:44 +0000 Subject: 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 --- collectstats.pl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'collectstats.pl') 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; +} + -- cgit v1.2.3-24-g4f1b