Explorar el Código

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

Signed-off-by: Simon L <szaimen@e.mail.de>
Simon L. hace 3 semanas
padre
commit
34ae1adcc5
Se han modificado 3 ficheros con 10 adiciones y 0 borrados
  1. 5 0
      config/config.sample.php
  2. 3 0
      core/templates/exception.php
  3. 2 0
      lib/private/legacy/OC_Template.php

+ 5 - 0
config/config.sample.php

@@ -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
  *

+ 3 - 0
core/templates/exception.php

@@ -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>

+ 2 - 0
lib/private/legacy/OC_Template.php

@@ -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();