From 6d7f0d100fc5efd15a4f80f82388f8cd18cec757 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 22 Dec 2005 06:30:39 +0000 Subject: [PATCH] * Fix raw sitenotice display on database error --- RELEASE-NOTES | 1 + includes/Database.php | 7 ++----- includes/GlobalFunctions.php | 7 ++++++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 837d51a925..c481ca3fb1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -345,6 +345,7 @@ fully support the editing toolbar, but was found to be too confusing. * (bug 675) Add page protection level for unregistered/new accounts * User::isNewbie now uses the registration date and $wgAutoconfirmAge * Log views show message when no matches +* Fix raw sitenotice display on database error === Caveats === diff --git a/includes/Database.php b/includes/Database.php index df56815236..9dc7bd3873 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -1797,11 +1797,8 @@ border=\"0\" ALT=\"Google\"> wfLogDBError( "Connection error: $error\n" ); - $msg = wfGetSiteNotice(); - if($msg == '') { - $msg = str_replace( '$1', $error, $noconnect ); - } - $text = $msg; + $text = str_replace( '$1', $error, $noconnect ); + $text .= wfGetSiteNotice(); if($wgUseFileCache) { if($wgTitle) { diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 8b97d8d8ad..7bfa34a9be 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1298,7 +1298,12 @@ function wfGetSiteNotice() { $notice = $wgSiteNotice; } if($notice != '-' && $notice != '') { - $notice = $wgOut->parse( $notice ); + if( is_object( $wgOut ) ) { + $notice = $wgOut->parse( $notice ); + } else { + wfDebug( "wfGetSiteNotice called with no \$wgOut available" ); + $notice = ''; + } } wfProfileOut( $fname ); return $notice; -- 2.20.1