r79903 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79902‎ | r79903 | r79904 >
Date:17:08, 9 January 2011
Author:nikerabbit
Status:resolved
Tags:
Comment:
Follow-up r79880: check if $wgLang can be used.
Changed the checks in Database.php to use is_object because of stub objects
Modified paths:
  • /trunk/phase3/includes/Exception.php (modified) (history)
  • /trunk/phase3/includes/db/Database.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/Database.php
@@ -2845,7 +2845,7 @@
28462846
28472847 $header = "$wgSitename has a problem";
28482848
2849 - if ( $wgLang instanceof Language ) {
 2849+ if ( is_object( $wgLang ) ) {
28502850 $header = htmlspecialchars( $wgLang->getMessage( 'dberr-header' ) );
28512851 }
28522852
@@ -2859,7 +2859,7 @@
28602860 $again = 'Try waiting a few minutes and reloading.';
28612861 $info = '(Can\'t contact the database server: $1)';
28622862
2863 - if ( $wgLang instanceof Language ) {
 2863+ if ( is_object( $wgLang ) ) {
28642864 $sorry = htmlspecialchars( $wgLang->getMessage( 'dberr-problems' ) );
28652865 $again = htmlspecialchars( $wgLang->getMessage( 'dberr-again' ) );
28662866 $info = htmlspecialchars( $wgLang->getMessage( 'dberr-info' ) );
@@ -2896,7 +2896,7 @@
28972897 $cachederror = "This is a cached copy of the requested page, and may not be up to date. ";
28982898
28992899 # Localize it if possible...
2900 - if ( $wgLang instanceof Language ) {
 2900+ if ( is_object( $wgLang ) ) {
29012901 $cachederror = htmlspecialchars( $wgLang->getMessage( 'dberr-cachederror' ) );
29022902 }
29032903
@@ -2921,7 +2921,7 @@
29222922 $outofdate = "Note that their indexes of our content may be out of date.";
29232923 $googlesearch = "Search";
29242924
2925 - if ( $wgLang instanceof Language ) {
 2925+ if ( is_object( $wgLang ) ) {
29262926 $usegoogle = htmlspecialchars( $wgLang->getMessage( 'dberr-usegoogle' ) );
29272927 $outofdate = htmlspecialchars( $wgLang->getMessage( 'dberr-outofdate' ) );
29282928 $googlesearch = htmlspecialchars( $wgLang->getMessage( 'searchbutton' ) );
@@ -2963,7 +2963,7 @@
29642964
29652965 $mainpage = 'Main Page';
29662966
2967 - if ( $wgLang instanceof Language ) {
 2967+ if ( is_object( $wgLang ) ) {
29682968 $mainpage = htmlspecialchars( $wgLang->getMessage( 'mainpage' ) );
29692969 }
29702970
Index: trunk/phase3/includes/Exception.php
@@ -238,14 +238,24 @@
239239
240240 $title = Html::element( 'title', null, $this->getPageTitle() );
241241
242 - $left = $wgLang->alignStart();
243 - $right = $wgLang->alignEnd();
 242+ $left = 'left';
 243+ $right = 'right';
 244+ $dir = 'ltr';
 245+ $code = 'en';
 246+
 247+ if ( $this->useMessageCache() ) {
 248+ $left = $wgLang->alignStart();
 249+ $right = $wgLang->alignEnd();
 250+ $dir = $wgLang->getDir();
 251+ $code = $wgLang->getCode();
 252+ }
 253+
244254 $header = Html::element( 'img', array(
245255 'src' => $wgLogo,
246256 'style' => "float: $left; margin-$right: 1em;",
247257 'alt' => '' ), $this->getPageTitle() );
248258
249 - $attribs = array( 'dir' => $wgLang->getDir(), 'lang' => $wgLang->getCode() );
 259+ $attribs = array( 'dir' => $dir, 'lang' => $code );
250260
251261 return
252262 Html::htmlHeader( $attribs ) .

Follow-up revisions

RevisionCommit summaryAuthorDate
r79909Partial revert of r79903, unstubbing needs localisation cache which might nee...nikerabbit18:31, 9 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79880* (bug 26638) Database error pages display correctly in RTL languagesnikerabbit10:36, 9 January 2011

Status & tagging log