From: Matthias Schmidt Date: Mon, 20 May 2013 09:19:10 +0000 (+0200) Subject: Fixes handling of excluded packages during package update X-Git-Tag: 2.0.0_Beta_1~138^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a48477eee5b2e3435cd865b830ff4ceeb1242358;p=GitHub%2FWoltLab%2FWCF.git Fixes handling of excluded packages during package update When a package is updated, the excluded packages of the current versions are deleted first and replaced by the new ones. This way, it's ensured that packages the current version excludes and which the updated version doesn't exclude anymore, are properly handled [cf. WCF 1.1]. --- diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index a142cbc5b1..486705b80c 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -268,17 +268,11 @@ class PackageInstallationDispatcher { $packageEditor = new PackageEditor(new Package($this->queue->packageID)); $packageEditor->update($nodeData); - // update excluded packages - if (count($this->getArchive()->getExcludedPackages()) > 0) { - $sql = "INSERT IGNORE INTO wcf".WCF_N."_package_exclusion - (packageID, excludedPackage, excludedPackageVersion) - VALUES (?, ?, ?)"; - $statement = WCF::getDB()->prepareStatement($sql); - - foreach ($this->getArchive()->getExcludedPackages() as $excludedPackage) { - $statement->execute(array($this->queue->packageID, $excludedPackage['name'], (!empty($excludedPackage['version']) ? $excludedPackage['version'] : ''))); - } - } + // delete old excluded packages + $sql = "DELETE FROM wcf".WCF_N."_package_exclusion + WHERE packageID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($this->queue->packageID)); // insert requirements and dependencies $requirements = $this->getArchive()->getAllExistingRequirements(); @@ -310,18 +304,6 @@ class PackageInstallationDispatcher { 'packageID' => $package->packageID )); - // save excluded packages - if (count($this->getArchive()->getExcludedPackages()) > 0) { - $sql = "INSERT INTO wcf".WCF_N."_package_exclusion - (packageID, excludedPackage, excludedPackageVersion) - VALUES (?, ?, ?)"; - $statement = WCF::getDB()->prepareStatement($sql); - - foreach ($this->getArchive()->getExcludedPackages() as $excludedPackage) { - $statement->execute(array($package->packageID, $excludedPackage['name'], (!empty($excludedPackage['version']) ? $excludedPackage['version'] : ''))); - } - } - // insert requirements and dependencies $requirements = $this->getArchive()->getAllExistingRequirements(); if (!empty($requirements)) { @@ -361,6 +343,18 @@ class PackageInstallationDispatcher { } } + // save excluded packages + if (count($this->getArchive()->getExcludedPackages())) { + $sql = "INSERT INTO wcf".WCF_N."_package_exclusion + (packageID, excludedPackage, excludedPackageVersion) + VALUES (?, ?, ?)"; + $statement = WCF::getDB()->prepareStatement($sql); + + foreach ($this->getArchive()->getExcludedPackages() as $excludedPackage) { + $statement->execute(array($this->queue->packageID, $excludedPackage['name'], (!empty($excludedPackage['version']) ? $excludedPackage['version'] : ''))); + } + } + if ($this->getPackage()->isApplication && $this->getPackage()->package != 'com.woltlab.wcf' && $this->getAction() == 'install') { if (empty($this->getPackage()->packageDir)) { $document = $this->promptPackageDir();