X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FException.php;h=4548345cbf23630f034b3ef839c0947cadad55b8;hb=d4ae43bb9fc535956b10c3ac2545e8aff1cf106d;hp=e1bfb2dd5615ed20266e2a22ab6675ed0336e06d;hpb=34981172de480cab30d120be9945d3da0384d42e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Exception.php b/includes/Exception.php index e1bfb2dd56..4548345cbf 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( $this->getTraceAsString() ) ) . + 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" . "