From 187abea3a3c393e2bc747d1ee5a064c6e0dcd97a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 15 Nov 2022 11:11:47 +0100 Subject: [PATCH] Stop using PackageArchive::getAllExistingRequirements() The method is overly complex and will be removed in a follow-up commit. --- .../PackageInstallationDispatcher.class.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index fbebb1abfb..2c5d343491 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -604,22 +604,22 @@ class PackageInstallationDispatcher } } - // insert requirements and dependencies - $requirements = $this->getArchive()->getAllExistingRequirements(); - if (!empty($requirements)) { - $sql = "INSERT INTO wcf1_package_requirement - (packageID, requirement) - VALUES (?, ?)"; - $statement = WCF::getDB()->prepare($sql); + $requirements = $this->getArchive()->getExistingRequirements(); + \assert( + \count($requirements) === \count($this->getArchive()->getRequirements()), + "The existence of all requirements has been checked at the start of the method." + ); - foreach ($requirements as $possibleRequirements) { - $requirement = \array_shift($possibleRequirements); + $sql = "INSERT INTO wcf1_package_requirement + (packageID, requirement) + VALUES (?, ?)"; + $statement = WCF::getDB()->prepare($sql); - $statement->execute([ - $this->queue->packageID, - $requirement['packageID'], - ]); - } + foreach ($requirements as $requirement) { + $statement->execute([ + $this->queue->packageID, + $requirement['packageID'], + ]); } if ( -- 2.20.1