]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: Prevent duplicate creation of print_exception function
authorLouis Chemineau <louis@chmn.me>
Wed, 18 Sep 2024 07:23:19 +0000 (09:23 +0200)
committerLouis <louis@chmn.me>
Tue, 8 Oct 2024 16:14:26 +0000 (18:14 +0200)
Signed-off-by: Louis Chemineau <louis@chmn.me>
core/templates/exception.php
core/templates/print_exception.php [new file with mode: 0644]
core/templates/print_xml_exception.php [new file with mode: 0644]
core/templates/xml_exception.php

index d26e9ff4f94ed420b26c3fe3f7d4469d835dd06c..324724e67ace2955cfff042a6e1ebd9de4a1f728 100644 (file)
@@ -4,20 +4,7 @@
 
 style('core', ['styles', 'header']);
 
-function print_exception(Throwable $e, \OCP\IL10N $l): void {
-       print_unescaped('<pre>');
-       p($e->getTraceAsString());
-       print_unescaped('</pre>');
-
-       if ($e->getPrevious() !== null) {
-               print_unescaped('<br />');
-               print_unescaped('<h4>');
-               p($l->t('Previous'));
-               print_unescaped('</h4>');
-
-               print_exception($e->getPrevious(), $l);
-       }
-}
+require_once __DIR__ . '/print_exception.php';
 
 ?>
 <div class="guest-box wide">
diff --git a/core/templates/print_exception.php b/core/templates/print_exception.php
new file mode 100644 (file)
index 0000000..2def6d4
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+/**
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2012-2015 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+function print_exception(Throwable $e, \OCP\IL10N $l): void {
+       print_unescaped('<pre>');
+       p($e->getTraceAsString());
+       print_unescaped('</pre>');
+
+       if ($e->getPrevious() !== null) {
+               print_unescaped('<br />');
+               print_unescaped('<h4>');
+               p($l->t('Previous'));
+               print_unescaped('</h4>');
+
+               print_exception($e->getPrevious(), $l);
+       }
+}
diff --git a/core/templates/print_xml_exception.php b/core/templates/print_xml_exception.php
new file mode 100644 (file)
index 0000000..94452d8
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+/**
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2012-2015 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+function print_exception(Throwable $e, \OCP\IL10N $l): void {
+       p($e->getTraceAsString());
+
+       if ($e->getPrevious() !== null) {
+               print_unescaped('<s:previous-exception>');
+               print_exception($e->getPrevious(), $l);
+               print_unescaped('</s:previous-exception>');
+       }
+}
index 342238d824bb7eb19e23f3f2a5f5b6a4977ab502..ba808c88595c2672f3c924c40330ebc6a6456315 100644 (file)
@@ -5,15 +5,7 @@
  * SPDX-License-Identifier: AGPL-3.0-only
  */
 
-function print_exception(Throwable $e, \OCP\IL10N $l): void {
-       p($e->getTraceAsString());
-
-       if ($e->getPrevious() !== null) {
-               print_unescaped('<s:previous-exception>');
-               print_exception($e->getPrevious(), $l);
-               print_unescaped('</s:previous-exception>');
-       }
-}
+require_once __DIR__ . '/print_xml_exception.php';
 
 print_unescaped('<?xml version="1.0" encoding="utf-8"?>' . "\n");
 ?>