From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- includes/Exception.php | 275 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 187 insertions(+), 88 deletions(-) (limited to 'includes/Exception.php') diff --git a/includes/Exception.php b/includes/Exception.php index 0bd7a2a7..5bad88c2 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -30,7 +30,6 @@ * @ingroup Exception */ class MWException extends Exception { - var $logId; /** * Should the exception use $wgOut to output the error? @@ -44,6 +43,16 @@ class MWException extends Exception { !empty( $GLOBALS['wgTitle'] ); } + /** + * Whether to log this exception in the exception debug log. + * + * @since 1.23 + * @return boolean + */ + function isLoggable() { + return true; + } + /** * Can the extension use the Message class/wfMessage to get i18n-ed messages? * @@ -75,11 +84,11 @@ class MWException extends Exception { return null; // Just silently ignore } - if ( !array_key_exists( $name, $wgExceptionHooks ) || !is_array( $wgExceptionHooks[ $name ] ) ) { + if ( !array_key_exists( $name, $wgExceptionHooks ) || !is_array( $wgExceptionHooks[$name] ) ) { return null; } - $hooks = $wgExceptionHooks[ $name ]; + $hooks = $wgExceptionHooks[$name]; $callargs = array_merge( array( $this ), $args ); foreach ( $hooks as $hook ) { @@ -126,13 +135,12 @@ class MWException extends Exception { global $wgShowExceptionDetails; if ( $wgShowExceptionDetails ) { - return '

' . nl2br( htmlspecialchars( $this->getMessage() ) ) . - '

Backtrace:

' . nl2br( htmlspecialchars( $this->getTraceAsString() ) ) . + return '

' . nl2br( htmlspecialchars( MWExceptionHandler::getLogMessage( $this ) ) ) . + '

Backtrace:

' . nl2br( htmlspecialchars( MWExceptionHandler::getRedactedTraceAsString( $this ) ) ) . "

\n"; } else { - return - "
" . - '[' . $this->getLogId() . '] ' . + return "
" . + '[' . MWExceptionHandler::getLogId( $this ) . '] ' . gmdate( 'Y-m-d H:i:s' ) . ": Fatal exception of type " . get_class( $this ) . "
\n" . "