Reedy has uploaded a new change for review.
https://gerrit.wikimedia.org/r/322777
Change subject: Replace wgShowExceptionDetails with wgShowDBErrorBacktrace on
db errors
......................................................................
Replace wgShowExceptionDetails with wgShowDBErrorBacktrace on db errors
Bug: T148957
Change-Id: I8891369156547e8931463a2fd55995cfa9e98ee7
---
M includes/exception/MWExceptionRenderer.php
1 file changed, 20 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/77/322777/1
diff --git a/includes/exception/MWExceptionRenderer.php
b/includes/exception/MWExceptionRenderer.php
index 8fdc417..873e8f4 100644
--- a/includes/exception/MWExceptionRenderer.php
+++ b/includes/exception/MWExceptionRenderer.php
@@ -61,8 +61,7 @@
"\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 @@
$logId,
MWExceptionHandler::getURL()
) . "</div>\n" .
- "<!-- Set \$wgShowExceptionDetails = true; " .
- "at the bottom of LocalSettings.php to show detailed " .
- "debugging information. -->";
+ "<!-- " . wordwrap(
self::getShowBacktraceError( $e ), 50 ) . " -->";
}
return $html;
@@ -262,8 +259,7 @@
"\nBacktrace:\n" .
MWExceptionHandler::getRedactedTraceAsString(
$e ) . "\n";
} else {
- return "Set \$wgShowExceptionDetails = true; " .
- "in LocalSettings.php to show detailed
debugging information.\n";
+ return self::getShowBacktraceError( $e );
}
}
@@ -281,6 +277,23 @@
}
/**
+ * @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
*/
private static function isCommandLine() {
--
To view, visit https://gerrit.wikimedia.org/r/322777
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8891369156547e8931463a2fd55995cfa9e98ee7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_28
Gerrit-Owner: Reedy <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits