feat(exception-template): allow to link to specific documentation for how to retreive server log

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L. 2024-04-26 15:52:11 +02:00
parent a2fefbce9a
commit 34ae1adcc5
3 changed files with 10 additions and 0 deletions

View File

@ -2235,6 +2235,11 @@ $CONFIG = [
*/
'upgrade.cli-upgrade-link' => '',
/**
* Allows to modify the exception server logs documentation link in order to link to a different documentation
*/
'documentation_url.server_logs' => '',
/**
* Set this Nextcloud instance to debugging mode
*

View File

@ -25,6 +25,9 @@ function print_exception(Throwable $e, \OCP\IL10N $l): void {
<p><?php p($l->t('The server was unable to complete your request.')) ?></p>
<p><?php p($l->t('If this happens again, please send the technical details below to the server administrator.')) ?></p>
<p><?php p($l->t('More details can be found in the server log.')) ?></p>
<?php if (isset($_['serverLogsDocumentation']) && $_['serverLogsDocumentation'] !== ''): ?>
<p><a href="<?php print_unescaped($_['serverLogsDocumentation']) ?>" target="_blank" rel="noopener"><?php p($l->t('See this documentation how to retreive them.')) ?></a></p>
<?php endif; ?>
<h3><?php p($l->t('Technical details')) ?></h3>
<ul>

View File

@ -306,6 +306,7 @@ class OC_Template extends \OC\Template\Base {
http_response_code($statusCode);
try {
$debug = \OC::$server->getSystemConfig()->getValue('debug', false);
$serverLogsDocumentation = \OC::$server->getSystemConfig()->getValue('documentation_url.server_logs', '');
$request = \OC::$server->getRequest();
$content = new \OC_Template('', 'exception', 'error', false);
$content->assign('errorClass', get_class($exception));
@ -315,6 +316,7 @@ class OC_Template extends \OC\Template\Base {
$content->assign('line', $exception->getLine());
$content->assign('exception', $exception);
$content->assign('debugMode', $debug);
$content->assign('serverLogsDocumentation', $serverLogsDocumentation);
$content->assign('remoteAddr', $request->getRemoteAddress());
$content->assign('requestID', $request->getId());
$content->printPage();