diff --git a/includes/Exception.php b/includes/Exception.php
index a91f8657a01..46402f92908 100644
--- a/includes/Exception.php
+++ b/includes/Exception.php
@@ -164,7 +164,8 @@ class MWException extends Exception {
* @return string
*/
function getPageTitle() {
- return $this->msg( 'internalerror', "Internal error" );
+ global $wgSitename;
+ return $this->msg( 'pagetitle', "$1 - $wgSitename", $this->msg( 'internalerror', 'Internal error' ) );
}
/**
@@ -209,13 +210,14 @@ class MWException extends Exception {
$wgOut->output();
} else {
- header( "Content-Type: text/html; charset=utf-8" );
- echo "\n" .
+ header( 'Content-Type: text/html; charset=utf-8' );
+ echo "\n" .
'
' .
'' . htmlspecialchars( $this->getPageTitle() ) . '' .
+ '' .
"\n";
- $hookResult = $this->runHooks( get_class( $this ) . "Raw" );
+ $hookResult = $this->runHooks( get_class( $this ) . 'Raw' );
if ( $hookResult ) {
echo $hookResult;
} else {
@@ -242,8 +244,8 @@ class MWException extends Exception {
} elseif ( self::isCommandLine() ) {
MWExceptionHandler::printError( $this->getText() );
} else {
- header( "HTTP/1.1 500 MediaWiki exception" );
- header( "Status: 500 MediaWiki exception", true );
+ header( 'HTTP/1.1 500 MediaWiki exception' );
+ header( 'Status: 500 MediaWiki exception', true );
header( "Content-Type: $wgMimeType; charset=utf-8", true );
$this->reportHTML();
diff --git a/includes/db/DatabaseError.php b/includes/db/DatabaseError.php
index da391d7aac8..937bea0fedf 100644
--- a/includes/db/DatabaseError.php
+++ b/includes/db/DatabaseError.php
@@ -66,8 +66,7 @@ class DBError extends MWException {
$s = $this->getHTMLContent();
if ( $wgShowDBErrorBacktrace ) {
- $s .= 'Backtrace:
' .
- nl2br( htmlspecialchars( $this->getTraceAsString() ) ) . '
';
+ $s .= 'Backtrace:
' . htmlspecialchars( $this->getTraceAsString() ) . '
';
}
return $s;
@@ -137,24 +136,17 @@ class DBConnectionError extends DBError {
* @return bool
*/
function getLogMessage() {
- # Don't send to the exception log
+ // Don't send to the exception log
return false;
}
- /**
- * @return string
- */
- function getPageTitle() {
- return $this->msg( 'dberr-header', 'This wiki has a problem' );
- }
-
/**
* @return string
*/
function getHTML() {
global $wgShowDBErrorBacktrace, $wgShowHostnames, $wgShowSQLErrors;
- $sorry = htmlspecialchars( $this->msg( 'dberr-problems', "Sorry!\nThis site is experiencing technical difficulties." ) );
+ $sorry = htmlspecialchars( $this->msg( 'dberr-problems', 'Sorry! This site is experiencing technical difficulties.' ) );
$again = htmlspecialchars( $this->msg( 'dberr-again', 'Try waiting a few minutes and reloading.' ) );
if ( $wgShowHostnames || $wgShowSQLErrors ) {
@@ -169,17 +161,16 @@ class DBConnectionError extends DBError {
# No database access
MessageCache::singleton()->disable();
- $text = "$sorry
$again
$info
";
+ $html = "$sorry
$again
$info
";
if ( $wgShowDBErrorBacktrace ) {
- $text .= 'Backtrace:
' .
- nl2br( htmlspecialchars( $this->getTraceAsString() ) ) . '
';
+ $html .= 'Backtrace:
' . htmlspecialchars( $this->getTraceAsString() ) . '
';
}
- $text .= '
';
- $text .= $this->searchForm();
+ $html .= '
';
+ $html .= $this->searchForm();
- return $text;
+ return $html;
}
protected function getTextContent() {
@@ -195,21 +186,21 @@ class DBConnectionError extends DBError {
public function reportHTML() {
global $wgUseFileCache;
- # Check whether we can serve a file-cached copy of the page with the error underneath
+ // Check whether we can serve a file-cached copy of the page with the error underneath
if ( $wgUseFileCache ) {
try {
$cache = $this->fileCachedPage();
- # Cached version on file system?
+ // Cached version on file system?
if ( $cache !== null ) {
- # Hack: extend the body for error messages
+ // Hack: extend the body for error messages
$cache = str_replace( array( '', '' ), '', $cache );
- # Add cache notice...
- $cache .= '' .
+ // Add cache notice...
+ $cache .= '
' .
htmlspecialchars( $this->msg( 'dberr-cachederror',
- 'This is a cached copy of the requested page, and may not be up to date. ' ) ) .
+ 'This is a cached copy of the requested page, and may not be up to date.' ) ) .
'
';
- # Output cached page with notices on bottom and re-close body
+ // Output cached page with notices on bottom and re-close body
echo "{$cache}
{$this->getHTML()}