]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 309796: Whining needs to check for shutdown (silently) before trying database...
authorlpsolit%gmail.com <>
Fri, 7 Oct 2005 03:54:49 +0000 (03:54 +0000)
committerlpsolit%gmail.com <>
Fri, 7 Oct 2005 03:54:49 +0000 (03:54 +0000)
Bugzilla.pm
whine.pl

index 99e5c3add52d276029c1fd05e5bc456e7157ce10..71e29a222dfacf24a3ef14a65b22a5087f411735 100644 (file)
@@ -49,6 +49,11 @@ use constant SHUTDOWNHTML_EXEMPT => [
     'checksetup.pl',
 ];
 
+# Non-cgi scripts that should silently exit.
+use constant SHUTDOWNHTML_EXIT_SILENTLY => [
+    'whine.pl'
+];
+
 #####################################################################
 # Global Code
 #####################################################################
@@ -62,6 +67,15 @@ use constant SHUTDOWNHTML_EXEMPT => [
 if (Param("shutdownhtml") 
     && lsearch(SHUTDOWNHTML_EXEMPT, basename($0)) == -1) 
 {
+    # Allow non-cgi scripts to exit silently (without displaying any
+    # message), if desired. At this point, no DBI call has been made
+    # yet, and no error will be returned if the DB is inaccessible.
+    if (lsearch(SHUTDOWNHTML_EXIT_SILENTLY, basename($0)) > -1
+        && !i_am_cgi())
+    {
+        exit;
+    }
+
     # For security reasons, log out users when Bugzilla is down.
     # Bugzilla->login() is required to catch the logincookie, if any.
     my $user = Bugzilla->login(LOGIN_OPTIONAL);
index f24db855dfae32ec4fa9cb2cb87964cbf5778230..937cbbace98dc5af8b70c156643de78a8682b138 100755 (executable)
--- a/whine.pl
+++ b/whine.pl
@@ -93,12 +93,6 @@ my $sth_schedules_by_event = $dbh->prepare(
 # After that, it looks over each user to see if they have schedules that need
 # running, then runs those and generates the email messages.
 
-# exit quietly if the system is shut down
-if (Param('shutdownhtml')) {
-    exit;
-}
-
-
 # Send whines from the address in the 'maintainer' Parameter so that all
 # Bugzilla-originated mail appears to come from a single address.
 my $fromaddress = Param('maintainer');