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

collectstats.pl
post_bug.cgi

index 80c70fe2be9822d8690e170234fb8c57532cc683..e9aad392f002bf7fcebfcb98f2707542beb198bb 100755 (executable)
@@ -33,6 +33,7 @@
 use AnyDBM_File;
 use strict;
 use IO::Handle;
+use Cwd;
 
 use 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") {
index 82317483b215d0193d456d5c1fd6e5e298b13ff7..ea1b30b82a3fd32533dcf92258c926840370e5d0 100755 (executable)
@@ -53,6 +53,9 @@ my $vars = {};
 # Main Script
 ######################################################################
 
+# redirect to enter_bug if no field is passed.
+print $cgi->redirect(correct_urlbase() . 'enter_bug.cgi') unless $cgi->param();
+
 # Detect if the user already used the same form to submit a bug
 my $token = trim($cgi->param('token'));
 if ($token) {