X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FException.php;h=008be15a383ddb527d4f6e460237f2af9b988ce1;hb=35970fb460060cab9a3984030241987a86146f09;hp=39fe6f4b30dff796313e0bdd27a2baa259f5545c;hpb=ae857e90c5c7914d70c070cea6b125e6aaf72ce5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Exception.php b/includes/Exception.php index 39fe6f4b30..008be15a38 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -30,8 +30,6 @@ * @ingroup Exception */ class MWException extends Exception { - var $logId; - /** * Should the exception use $wgOut to output the error? * @@ -44,6 +42,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,7 +83,9 @@ 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; } @@ -83,7 +93,11 @@ class MWException extends Exception { $callargs = array_merge( array( $this ), $args ); foreach ( $hooks as $hook ) { - if ( is_string( $hook ) || ( is_array( $hook ) && count( $hook ) >= 2 && is_string( $hook[0] ) ) ) { // 'function' or array( 'class', hook' ) + if ( + is_string( $hook ) || + ( is_array( $hook ) && count( $hook ) >= 2 && is_string( $hook[0] ) ) + ) { + // 'function' or array( 'class', hook' ) $result = call_user_func_array( $hook, $callargs ); } else { $result = null; @@ -126,12 +140,12 @@ class MWException extends Exception { global $wgShowExceptionDetails; if ( $wgShowExceptionDetails ) { - return '

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

Backtrace:

' . nl2br( htmlspecialchars( MWExceptionHandler::formatRedactedTrace( $this ) ) ) . + return '

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

Backtrace:

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

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