From 8592cb4ff0bfa7e90373bdbaf71bf94fb5a4a174 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Thu, 6 Oct 2005 20:54:49 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20309796:=20Whining=20needs=20to=20check=20?= =?UTF-8?q?for=20shutdown=20(silently)=20before=20trying=20database=20acce?= =?UTF-8?q?ss=20-=20Patch=20by=20Fr=C3=A9d=C3=A9ric=20Buclin=20=20r=3Djoel=20a=3Djustdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@181728 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/Bugzilla.pm | 14 ++++++++++++++ mozilla/webtools/bugzilla/whine.pl | 6 ------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/mozilla/webtools/bugzilla/Bugzilla.pm b/mozilla/webtools/bugzilla/Bugzilla.pm index 99e5c3add52..71e29a222df 100644 --- a/mozilla/webtools/bugzilla/Bugzilla.pm +++ b/mozilla/webtools/bugzilla/Bugzilla.pm @@ -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); diff --git a/mozilla/webtools/bugzilla/whine.pl b/mozilla/webtools/bugzilla/whine.pl index f24db855dfa..937cbbace98 100755 --- a/mozilla/webtools/bugzilla/whine.pl +++ b/mozilla/webtools/bugzilla/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');