summaryrefslogtreecommitdiffstats
path: root/collectstats.pl
diff options
context:
space:
mode:
authorbbaetz%acm.org <>2003-11-22 12:50:36 +0100
committerbbaetz%acm.org <>2003-11-22 12:50:36 +0100
commitda857afa089e79ad16fb833dd1ffe397055fd892 (patch)
tree4582f630aa59c35fdb25aa30fd71c617977e0a86 /collectstats.pl
parent63790559f094b702688365ed12242526ce3ff969 (diff)
downloadbugzilla-da857afa089e79ad16fb833dd1ffe397055fd892.tar.gz
bugzilla-da857afa089e79ad16fb833dd1ffe397055fd892.tar.xz
Bug 208604 - Make data/template dir locations configurable
Diffstat (limited to 'collectstats.pl')
-rwxr-xr-xcollectstats.pl17
1 files changed, 9 insertions, 8 deletions
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 (<CGI>) {
print RDF if $headers_done;
@@ -96,9 +97,9 @@ while (<CGI>) {
}
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 = <data/duplicates/dupes$today*>) {
+ 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.