From b8ec302b3a99b54f5838e497adb1cabe3f2f15dd Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sun, 21 Sep 2008 23:40:40 +0000 Subject: [PATCH] =?utf8?q?Bug=20398075:=20Bugzilla=20should=20be=20able=20?= =?utf8?q?to=20display=20the=20"shutdownhtml"=20message=20even=20if=20the?= =?utf8?q?=20SQL=20server=20is=20down=20-=20Patch=20by=20Fr=C3=83=C2=A9d?= =?utf8?q?=C3=83=C2=A9ric=20Buclin=20=20r/a=3Dmkanat?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Bugzilla.pm | 8 +++++++- template/en/default/global/common-links.html.tmpl | 2 +- template/en/default/global/field-descs.none.tmpl | 10 ++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Bugzilla.pm b/Bugzilla.pm index ba3e75d892..b8d2e9b84d 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -139,7 +139,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 4690d177a5..18695a8c6f 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 %]