From 8b32822137a7248fa63f995aaa089d7e2e2ec9c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Sun, 9 Jan 2011 17:08:40 +0000 Subject: [PATCH] Follow-up r79880: check if $wgLang can be used. Changed the checks in Database.php to use is_object because of stub objects --- includes/Exception.php | 16 +++++++++++++--- includes/db/Database.php | 10 +++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/includes/Exception.php b/includes/Exception.php index 76cd6412cc..cd209abae3 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -238,14 +238,24 @@ class MWException extends Exception { $title = Html::element( 'title', null, $this->getPageTitle() ); - $left = $wgLang->alignStart(); - $right = $wgLang->alignEnd(); + $left = 'left'; + $right = 'right'; + $dir = 'ltr'; + $code = 'en'; + + if ( $this->useMessageCache() ) { + $left = $wgLang->alignStart(); + $right = $wgLang->alignEnd(); + $dir = $wgLang->getDir(); + $code = $wgLang->getCode(); + } + $header = Html::element( 'img', array( 'src' => $wgLogo, 'style' => "float: $left; margin-$right: 1em;", 'alt' => '' ), $this->getPageTitle() ); - $attribs = array( 'dir' => $wgLang->getDir(), 'lang' => $wgLang->getCode() ); + $attribs = array( 'dir' => $dir, 'lang' => $code ); return Html::htmlHeader( $attribs ) . diff --git a/includes/db/Database.php b/includes/db/Database.php index 4d75379c58..f2bce439c9 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2845,7 +2845,7 @@ class DBConnectionError extends DBError { $header = "$wgSitename has a problem"; - if ( $wgLang instanceof Language ) { + if ( is_object( $wgLang ) ) { $header = htmlspecialchars( $wgLang->getMessage( 'dberr-header' ) ); } @@ -2859,7 +2859,7 @@ class DBConnectionError extends DBError { $again = 'Try waiting a few minutes and reloading.'; $info = '(Can\'t contact the database server: $1)'; - if ( $wgLang instanceof Language ) { + if ( is_object( $wgLang ) ) { $sorry = htmlspecialchars( $wgLang->getMessage( 'dberr-problems' ) ); $again = htmlspecialchars( $wgLang->getMessage( 'dberr-again' ) ); $info = htmlspecialchars( $wgLang->getMessage( 'dberr-info' ) ); @@ -2896,7 +2896,7 @@ class DBConnectionError extends DBError { $cachederror = "This is a cached copy of the requested page, and may not be up to date. "; # Localize it if possible... - if ( $wgLang instanceof Language ) { + if ( is_object( $wgLang ) ) { $cachederror = htmlspecialchars( $wgLang->getMessage( 'dberr-cachederror' ) ); } @@ -2921,7 +2921,7 @@ class DBConnectionError extends DBError { $outofdate = "Note that their indexes of our content may be out of date."; $googlesearch = "Search"; - if ( $wgLang instanceof Language ) { + if ( is_object( $wgLang ) ) { $usegoogle = htmlspecialchars( $wgLang->getMessage( 'dberr-usegoogle' ) ); $outofdate = htmlspecialchars( $wgLang->getMessage( 'dberr-outofdate' ) ); $googlesearch = htmlspecialchars( $wgLang->getMessage( 'searchbutton' ) ); @@ -2963,7 +2963,7 @@ EOT; $mainpage = 'Main Page'; - if ( $wgLang instanceof Language ) { + if ( is_object( $wgLang ) ) { $mainpage = htmlspecialchars( $wgLang->getMessage( 'mainpage' ) ); } -- 2.20.1