From: Alexandre Emsenhuber Date: Thu, 2 Apr 2009 19:44:33 +0000 (+0000) Subject: Catch exceptions, since this part is likely to throw an exeception and use the defaul... X-Git-Tag: 1.31.0-rc.0~42247 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=dc70a8b27033ba76e699b32fd405b903fd50642f;p=lhc%2Fweb%2Fwiklou.git Catch exceptions, since this part is likely to throw an exeception and use the default page if it occured. --- diff --git a/includes/db/Database.php b/includes/db/Database.php index abd8f201fd..19abd9974c 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2587,20 +2587,24 @@ class DBConnectionError extends DBError { $extra = $this->searchForm(); if( $wgUseFileCache ) { - $cache = $this->fileCachedPage(); - # Cached version on file system? - if( $cache !== null ) { - # Hack: extend the body for error messages - $cache = str_replace( array('',''), '', $cache ); - # Add cache notice... - $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 ) { - $cachederror = htmlspecialchars( $wgLang->getMessage( 'dberr-cachederror' ) ); + try { + $cache = $this->fileCachedPage(); + # Cached version on file system? + if( $cache !== null ) { + # Hack: extend the body for error messages + $cache = str_replace( array('',''), '', $cache ); + # Add cache notice... + $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 ) { + $cachederror = htmlspecialchars( $wgLang->getMessage( 'dberr-cachederror' ) ); + } + $warning = "
$cachederror
"; + # Output cached page with notices on bottom and re-close body + return "{$cache}{$warning}
$text
$extra"; } - $warning = "
$cachederror
"; - # Output cached page with notices on bottom and re-close body - return "{$cache}{$warning}
$text
$extra"; + } catch( MWException $e ) { + // Do nothing, just use the default page } } # Headers needed here - output is just the error message @@ -2653,9 +2657,9 @@ EOT; $mainpage = htmlspecialchars( $wgLang->getMessage( 'mainpage' ) ); } - if($wgTitle) { + if( $wgTitle ) { $t =& $wgTitle; - } elseif($title) { + } elseif( $title ) { $t = Title::newFromURL( $title ); } else { $t = Title::newFromText( $mainpage );