Add assertion to PackageInstallationNodeBuilder::buildPluginNodes()
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 15 Sep 2022 10:44:38 +0000 (12:44 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 15 Sep 2022 10:44:38 +0000 (12:44 +0200)
wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php

index de9fca7311406024566d6011a06389be01762000..42d5265fa40dfdc8e16b6f569a82f0df7f1afcef 100644 (file)
@@ -645,24 +645,23 @@ class PackageInstallationNodeBuilder
             }
         }
 
-        // insert nodes
-        if (!empty($pluginNodes)) {
-            $sql = "INSERT INTO wcf" . WCF_N . "_package_installation_node
-                                (queueID, processNo, sequenceNo, node, parentNode, nodeType, nodeData)
-                    VALUES      (?, ?, ?, ?, ?, ?, ?)";
-            $statement = WCF::getDB()->prepareStatement($sql);
+        \assert($pluginNodes !== []);
 
-            foreach ($pluginNodes as $nodeData) {
-                $statement->execute([
-                    $this->installation->queue->queueID,
-                    $this->installation->queue->processNo,
-                    $nodeData['sequenceNo'],
-                    $nodeData['node'],
-                    $nodeData['parentNode'],
-                    'pip',
-                    \serialize($nodeData['data']),
-                ]);
-            }
+        $sql = "INSERT INTO wcf" . WCF_N . "_package_installation_node
+                            (queueID, processNo, sequenceNo, node, parentNode, nodeType, nodeData)
+                VALUES      (?, ?, ?, ?, ?, ?, ?)";
+        $statement = WCF::getDB()->prepareStatement($sql);
+
+        foreach ($pluginNodes as $nodeData) {
+            $statement->execute([
+                $this->installation->queue->queueID,
+                $this->installation->queue->processNo,
+                $nodeData['sequenceNo'],
+                $nodeData['node'],
+                $nodeData['parentNode'],
+                'pip',
+                \serialize($nodeData['data']),
+            ]);
         }
     }