From da857afa089e79ad16fb833dd1ffe397055fd892 Mon Sep 17 00:00:00 2001 From: "bbaetz%acm.org" <> Date: Sat, 22 Nov 2003 11:50:36 +0000 Subject: Bug 208604 - Make data/template dir locations configurable --- collectstats.pl | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'collectstats.pl') diff --git a/collectstats.pl b/collectstats.pl index 5c1f6d499..002d5fba2 100755 --- a/collectstats.pl +++ b/collectstats.pl @@ -38,6 +38,7 @@ use Bugzilla::Search; use Bugzilla::User; use Bugzilla; +use Bugzilla::Config qw(:DEFAULT $datadir); # Turn off output buffering (probably needed when displaying output feedback # in the regenerate mode.) @@ -66,7 +67,7 @@ push( @myproducts, "-All-", @::legal_product ); my $tstart = time; foreach (@myproducts) { - my $dir = "data/mining"; + my $dir = "$datadir/mining"; &check_data_dir ($dir); @@ -87,8 +88,8 @@ CollectSeriesData(); # Generate a static RDF file containing the default view of the duplicates data. open(CGI, "GATEWAY_INTERFACE=cmdline REQUEST_METHOD=GET QUERY_STRING=ctype=rdf ./duplicates.cgi |") || die "can't fork duplicates.cgi: $!"; -open(RDF, ">data/duplicates.tmp") - || die "can't write to data/duplicates.tmp: $!"; +open(RDF, ">$datadir/duplicates.tmp") + || die "can't write to $datadir/duplicates.tmp: $!"; my $headers_done = 0; while () { print RDF if $headers_done; @@ -96,9 +97,9 @@ while () { } close CGI; close RDF; -if (-s "data/duplicates.tmp") { - rename("data/duplicates.rdf", "data/duplicates-old.rdf"); - rename("data/duplicates.tmp", "data/duplicates.rdf"); +if (-s "$datadir/duplicates.tmp") { + rename("$datadir/duplicates.rdf", "$datadir/duplicates-old.rdf"); + rename("$datadir/duplicates.tmp", "$datadir/duplicates.rdf"); } sub check_data_dir { @@ -182,11 +183,11 @@ sub calculate_dupes { # 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 (my @files = ) { + if (my @files = <$datadir/duplicates/dupes$today*>) { unlink @files; } - dbmopen(%count, "data/duplicates/dupes$today", 0644) || die "Can't open DBM dupes file: $!"; + dbmopen(%count, "$datadir/duplicates/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. -- cgit v1.2.3-24-g4f1b