From 2db7cb905c176baacb6e447219aca7b5f6de5bd9 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 1 Sep 2019 14:37:02 +0200 Subject: [PATCH] Print split node exception messages in update log See #3043 --- .../PackageInstallationDispatcher.class.php | 9 ++++++-- .../package/PackageInstallationStep.class.php | 21 ++++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index 548214ad0b..ab76af9cbe 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -154,7 +154,12 @@ class PackageInstallationDispatcher { } if ($step->splitNode()) { - $this->logInstallationStep($data, 'split node'); + $log = 'split node'; + if ($step->getException() !== null && $step->getException()->getMessage()) { + $log .= ': ' . $step->getException()->getMessage(); + } + + $this->logInstallationStep($data, $log); $this->nodeBuilder->cloneNode($node, $data['sequenceNo']); break; } @@ -737,7 +742,7 @@ class PackageInstallationDispatcher { $document = $plugin->{$this->action}(); } catch (SplitNodeException $e) { - $step->setSplitNode(); + $step->setSplitNode($e); } if ($document !== null && ($document instanceof FormDocument)) { diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationStep.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationStep.class.php index 8404bf1318..6449ec5cf2 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationStep.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationStep.class.php @@ -17,6 +17,12 @@ class PackageInstallationStep { */ protected $document = null; + /** + * exception causing node splitting + * @var null|SplitNodeException + */ + protected $exception; + /** * next installation node * @var string @@ -56,6 +62,16 @@ class PackageInstallationStep { $this->document = $document; } + /** + * Returns the exception causing node splitting or `null` if the node has not been split + * or if it was not split by an exception. + * + * @return null|SplitNodeException + */ + public function getException() { + return $this->exception; + } + /** * Returns HTML-representation of form document object. * @@ -76,9 +92,12 @@ class PackageInstallationStep { /** * Enforces node splitting. + * + * @param null|SplitNodeException $splitNodeException */ - public function setSplitNode() { + public function setSplitNode(SplitNodeException $splitNodeException = null) { $this->splitNode = true; + $this->exception = $splitNodeException; } /** -- 2.20.1