X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fexception%2FMWExceptionRenderer.php;h=5d75036566f616c5ccf3bbfb18f1ac23f8b86558;hb=0e339243f1dbbba5f87a54b116c23e0daec8e2e4;hp=b22e87bf4a318574b5a8ad9d548b503b11fb0ec9;hpb=6f680554ceb988f3895184167d5006d722a0afb3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/exception/MWExceptionRenderer.php b/includes/exception/MWExceptionRenderer.php index b22e87bf4a..5d75036566 100644 --- a/includes/exception/MWExceptionRenderer.php +++ b/includes/exception/MWExceptionRenderer.php @@ -47,13 +47,15 @@ class MWExceptionRenderer { self::printError( self::getText( $e ) ); } elseif ( $mode === self::AS_PRETTY ) { self::statusHeader( 500 ); + self::header( "Content-Type: $wgMimeType; charset=utf-8" ); if ( $e instanceof DBConnectionError ) { self::reportOutageHTML( $e ); } else { - self::header( "Content-Type: $wgMimeType; charset=utf-8" ); self::reportHTML( $e ); } } else { + self::statusHeader( 500 ); + self::header( "Content-Type: $wgMimeType; charset=utf-8" ); if ( $eNew ) { $message = "MediaWiki internal error.\n\n"; if ( self::showBackTrace( $e ) ) { @@ -90,7 +92,7 @@ class MWExceptionRenderer { private static function useOutputPage( $e ) { // Can the extension use the Message class/wfMessage to get i18n-ed messages? foreach ( $e->getTrace() as $frame ) { - if ( isset( $frame['class'] ) && $frame['class'] === 'LocalisationCache' ) { + if ( isset( $frame['class'] ) && $frame['class'] === LocalisationCache::class ) { return false; } } @@ -292,7 +294,7 @@ class MWExceptionRenderer { * @param Exception|Throwable $e */ private static function reportOutageHTML( $e ) { - global $wgShowDBErrorBacktrace, $wgShowHostnames, $wgShowSQLErrors; + global $wgShowDBErrorBacktrace, $wgShowHostnames, $wgShowSQLErrors, $wgSitename; $sorry = htmlspecialchars( self::msg( 'dberr-problems', @@ -317,55 +319,20 @@ class MWExceptionRenderer { } MessageCache::singleton()->disable(); // no DB access - - $html = "

$sorry

$again

$info

"; + $html = "\n" . + '' . + '' . + htmlspecialchars( $wgSitename ) . + '' . + '' . + "

$sorry

$again

$info

"; if ( $wgShowDBErrorBacktrace ) { $html .= '

Backtrace:

' .
 				htmlspecialchars( $e->getTraceAsString() ) . '
'; } - $html .= '
'; - $html .= self::googleSearchForm(); - + $html .= ''; echo $html; } - - /** - * @return string - */ - private static function googleSearchForm() { - global $wgSitename, $wgCanonicalServer, $wgRequest; - - $usegoogle = htmlspecialchars( self::msg( - 'dberr-usegoogle', - 'You can try searching via Google in the meantime.' - ) ); - $outofdate = htmlspecialchars( self::msg( - 'dberr-outofdate', - 'Note that their indexes of our content may be out of date.' - ) ); - $googlesearch = htmlspecialchars( self::msg( 'searchbutton', 'Search' ) ); - $search = htmlspecialchars( $wgRequest->getVal( 'search' ) ); - $server = htmlspecialchars( $wgCanonicalServer ); - $sitename = htmlspecialchars( $wgSitename ); - $trygoogle = <<$usegoogle
-$outofdate - -
- - - - - - -

- - -

-
-EOT; - return $trygoogle; - } }