X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fexception%2FMWExceptionRenderer.php;h=873e8f423f82b6b5fa6e00e42cbbf29c7f8bf995;hp=8fdc417c1ef3724b59ab28493af7bfa029669748;hb=57a1e7b2705798b9ee8c01339839d5c7895542fa;hpb=650a0279d82ce2daaa42fd494c5be2cc55fab28d diff --git a/includes/exception/MWExceptionRenderer.php b/includes/exception/MWExceptionRenderer.php index 8fdc417c1e..873e8f423f 100644 --- a/includes/exception/MWExceptionRenderer.php +++ b/includes/exception/MWExceptionRenderer.php @@ -61,8 +61,7 @@ class MWExceptionRenderer { "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString( $eNew ); } else { $message .= "Exception caught inside exception handler.\n\n" . - "Set \$wgShowExceptionDetails = true; at the bottom of LocalSettings.php " . - "to show detailed debugging information."; + self::getShowBacktraceError( $e ); } $message .= "\n"; } else { @@ -226,9 +225,7 @@ class MWExceptionRenderer { $logId, MWExceptionHandler::getURL() ) . "\n" . - ""; + ""; } return $html; @@ -262,8 +259,7 @@ class MWExceptionRenderer { "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString( $e ) . "\n"; } else { - return "Set \$wgShowExceptionDetails = true; " . - "in LocalSettings.php to show detailed debugging information.\n"; + return self::getShowBacktraceError( $e ); } } @@ -280,6 +276,23 @@ class MWExceptionRenderer { ); } + /** + * @param Exception|Throwable $e + * @return string + */ + private static function getShowBacktraceError( $e ) { + global $wgShowExceptionDetails, $wgShowDBErrorBacktrace; + $vars = []; + if ( !$wgShowExceptionDetails ) { + $vars[] = '$wgShowExceptionDetails = true;'; + } + if ( $e instanceof DBError && !$wgShowDBErrorBacktrace ) { + $vars[] = '$wgShowDBErrorBacktrace = true;'; + } + $vars = implode( ' and ', $vars ); + return "Set $vars at the bottom of LocalSettings.php to show detailed debugging information"; + } + /** * @return bool */