]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 429379: collectstats.pl fails if ./graphs is a symlink
authorjustdave%bugzilla.org <>
Thu, 17 Apr 2008 04:14:14 +0000 (04:14 +0000)
committerjustdave%bugzilla.org <>
Thu, 17 Apr 2008 04:14:14 +0000 (04:14 +0000)
r=mkanat, a=mkanat

collectstats.pl

index 1e5c5fd9d1a74d2546e878230be294fb0b3cae89..4515b424c484785c052b4e2a668b0d841e72126f 100755 (executable)
@@ -33,6 +33,7 @@
 use AnyDBM_File;
 use strict;
 use IO::Handle;
+use Cwd;
 
 use lib qw(. lib);
 
@@ -50,10 +51,12 @@ use Bugzilla::Field;
 $| = 1;
 
 # Tidy up after graphing module
+my $cwd = Cwd::getcwd();
 if (chdir("graphs")) {
     unlink <./*.gif>;
     unlink <./*.png>;
-    chdir("..");
+    # chdir("..") doesn't work if graphs is a symlink, see bug 429378
+    chdir($cwd);
 }
 
 # This is a pure command line script.
@@ -61,6 +64,7 @@ Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
 
 my $dbh = Bugzilla->switch_to_shadow_db();
 
+
 # To recreate the daily statistics,  run "collectstats.pl --regenerate" .
 my $regenerate = 0;
 if ($#ARGV >= 0 && $ARGV[0] eq "--regenerate") {