Print split node exception messages in update log
authorMatthias Schmidt <gravatronics@live.com>
Sun, 1 Sep 2019 12:37:02 +0000 (14:37 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 1 Sep 2019 12:37:02 +0000 (14:37 +0200)
See #3043

wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationStep.class.php

index 548214ad0bf91dca2135cea5235c13929fb89a72..ab76af9cbe06b7d24a3678c4e77556f9d1a23a91 100644 (file)
@@ -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)) {
index 8404bf1318ddf7265dedd6d68efc301fb5aae94d..6449ec5cf2cc6276e54f47aab248099a0d24a4b7 100644 (file)
@@ -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;
        }
        
        /**