From: Marcel Werk Date: Fri, 22 Jul 2016 17:27:59 +0000 (+0200) Subject: Added missing exclusion checks of installed packages X-Git-Tag: 3.0.0_Beta_1~993 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3eb02bd8b2f803d2e38479f537304f89708fb756;p=GitHub%2FWoltLab%2FWCF.git Added missing exclusion checks of installed packages --- diff --git a/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php b/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php index c70b8952c5..7e645ae62d 100644 --- a/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php +++ b/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php @@ -127,10 +127,13 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { } // get excluded packages + $conditions = new PreparedStatementConditionBuilder(); + $conditions->add("packageUpdateVersionID IN (SELECT packageUpdateVersionID FROM wcf".WCF_N."_package_update_version WHERE packageUpdateID IN (?))", [$packageUpdateIDs]); $sql = "SELECT * - FROM wcf".WCF_N."_package_update_exclusion"; + FROM wcf".WCF_N."_package_update_exclusion + ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(); + $statement->execute($conditions->getParameters()); $excludedPackages = []; while ($row = $statement->fetchArray()) { $package = $row['excludedPackage']; @@ -152,6 +155,21 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { $statement->execute(); $installedPackages = $statement->fetchMap('package', 'packageVersion'); + // get excluded packages (of installed packages) + $excludedPackagesOfInstalledPackages = []; + $sql = "SELECT excludedPackage, excludedPackageVersion + FROM wcf".WCF_N."_package_exclusion"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(); + while ($row = $statement->fetchArray()) { + if (!isset($excludedPackagesOfInstalledPackages[$row['excludedPackage']])) { + $excludedPackagesOfInstalledPackages[$row['excludedPackage']] = $row['excludedPackageVersion']; + } + else if (Package::compareVersion($excludedPackagesOfInstalledPackages[$row['excludedPackage']], $row['excludedPackageVersion'], '>')) { + $excludedPackagesOfInstalledPackages[$row['excludedPackage']] = $row['excludedPackageVersion']; + } + } + // filter by version $conditions = new PreparedStatementConditionBuilder(); $conditions->add("puv.packageUpdateID IN (?)", [$packageUpdateIDs]); @@ -183,6 +201,12 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { continue; } } + // check excluded packages of installed packages + if (isset($excludedPackagesOfInstalledPackages[$row['package']])) { + if (Package::compareVersion($packageVersion, $excludedPackagesOfInstalledPackages[$row['package']], '>=')) { + continue; + } + } if (!isset($packageVersions[$package])) { $packageVersions[$package] = [];