From: lpsolit%gmail.com <> Date: Sun, 21 Sep 2008 23:42:44 +0000 (+0000) Subject: Bug 398075: Bugzilla should be able to display the "shutdownhtml" message even if... X-Git-Tag: bugzilla-3.2rc2~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d90d156b72e94116c19761b7c3c5066197c0c5d;p=thirdparty%2Fbugzilla.git Bug 398075: Bugzilla should be able to display the "shutdownhtml" message even if the SQL server is down - Patch by Frédéric Buclin r/a=mkanat --- diff --git a/Bugzilla.pm b/Bugzilla.pm index abba18924a..df19d2fdaa 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -138,7 +138,13 @@ sub init_page { # 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); + my $user; + eval { $user = Bugzilla->login(LOGIN_OPTIONAL); }; + if ($@) { + # The DB is not accessible. Use the default user object. + $user = Bugzilla->user; + $user->{settings} = {}; + } my $userid = $user->id; Bugzilla->logout(); diff --git a/template/en/default/global/common-links.html.tmpl b/template/en/default/global/common-links.html.tmpl index bfd18af4d5..29822d4429 100644 --- a/template/en/default/global/common-links.html.tmpl +++ b/template/en/default/global/common-links.html.tmpl @@ -39,7 +39,7 @@
  • | Reports
  • - [% IF Bugzilla.has_flags %] + [% IF Param('shutdownhtml') || Bugzilla.has_flags %] | [% IF user.id %]