X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fexception%2FMWExceptionRenderer.php;h=88b28df385df0cd30a39875664cb0db91e77e3f3;hb=8c96aec32cffaab96b2bd9dca206a99a13640545;hp=bb5e4f4eda915f489bc034c6df86085426f82224;hpb=3e88f9fa2a5a00bc1330560accf8e9d09c8be42a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/exception/MWExceptionRenderer.php b/includes/exception/MWExceptionRenderer.php index bb5e4f4eda..88b28df385 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; } } @@ -128,7 +130,7 @@ class MWExceptionRenderer { // Show any custom GUI message before the details if ( $e instanceof MessageSpecifier ) { - $wgOut->addHTML( Message::newFromSpecifier( $e )->escaped() ); + $wgOut->addHTML( Html::element( 'p', [], Message::newFromSpecifier( $e )->text() ) ); } $wgOut->addHTML( self::getHTML( $e ) ); @@ -169,14 +171,15 @@ class MWExceptionRenderer { } else { $logId = WebRequest::getRequestId(); $html = "
" . - '[' . $logId . '] ' . - gmdate( 'Y-m-d H:i:s' ) . ": " . - self::msg( "internalerror-fatal-exception", - "Fatal exception of type $1", - get_class( $e ), - $logId, - MWExceptionHandler::getURL() - ) . "
\n" . + htmlspecialchars( + '[' . $logId . '] ' . + gmdate( 'Y-m-d H:i:s' ) . ": " . + self::msg( "internalerror-fatal-exception", + "Fatal exception of type $1", + get_class( $e ), + $logId, + MWExceptionHandler::getURL() + ) ) . "\n" . ""; } @@ -291,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', @@ -316,8 +319,13 @@ class MWExceptionRenderer { } MessageCache::singleton()->disable(); // no DB access - - $html = "

$sorry

$again

$info

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

$sorry

$again

$info

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

Backtrace:

' .
@@ -326,7 +334,7 @@ class MWExceptionRenderer {
 
 		$html .= '
'; $html .= self::googleSearchForm(); - + $html .= ''; echo $html; }