From 51d00438eb1d6ca263bac3b97821d222f85913c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 3 Aug 2021 12:00:26 +0200 Subject: [PATCH] Do not store optional information from update servers within the database These do not appear to be used anywhere and the official package servers do not expose them either, making them effectively empty even in current versions. see fd3511448663b86f4428e848bbefa07b93bf4bad see #4371 see #4385 --- ...tlab.wcf_5.5_clearPackageDeprecations.php} | 6 ++++- .../package/PackageUpdateDispatcher.class.php | 26 +------------------ wcfsetup/setup/db/install.sql | 1 + 3 files changed, 7 insertions(+), 26 deletions(-) rename wcfsetup/install/files/acp/{update_com.woltlab.wcf_5.5_clearPackageCompatibility.php => update_com.woltlab.wcf_5.5_clearPackageDeprecations.php} (71%) diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_clearPackageCompatibility.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_clearPackageDeprecations.php similarity index 71% rename from wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_clearPackageCompatibility.php rename to wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_clearPackageDeprecations.php index 389de518b5..20d2c621bd 100644 --- a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_clearPackageCompatibility.php +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_clearPackageDeprecations.php @@ -1,7 +1,7 @@ execute(); $sql = "DELETE FROM wcf1_package_update_compatibility"; $statement = WCF::getDB()->prepare($sql); $statement->execute(); + +$sql = "DELETE FROM wcf1_package_update_optional"; +$statement = WCF::getDB()->prepare($sql); +$statement->execute(); diff --git a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php index 6e4fb21167..d85eac39e9 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php @@ -524,7 +524,7 @@ class PackageUpdateDispatcher extends SingletonFactory */ protected function savePackageUpdates(array &$allNewPackages, $packageUpdateServerID) { - $excludedPackagesParameters = $optionalInserts = $requirementInserts = []; + $excludedPackagesParameters = $requirementInserts = []; $sql = "INSERT INTO wcf" . WCF_N . "_package_update (packageUpdateServerID, package, packageName, packageDescription, author, authorURL, isApplication, pluginStoreFileID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; @@ -602,15 +602,6 @@ class PackageUpdateDispatcher extends SingletonFactory } } - if (isset($versionData['optionalPackages'])) { - foreach ($versionData['optionalPackages'] as $optionalPackage) { - $optionalInserts[] = [ - 'packageUpdateVersionID' => $packageUpdateVersionID, - 'package' => $optionalPackage, - ]; - } - } - if (isset($versionData['excludedPackages'])) { foreach ($versionData['excludedPackages'] as $excludedIdentifier => $exclusion) { $excludedPackagesParameters[] = [ @@ -680,21 +671,6 @@ class PackageUpdateDispatcher extends SingletonFactory WCF::getDB()->commitTransaction(); } - if (!empty($optionalInserts)) { - $sql = "INSERT INTO wcf" . WCF_N . "_package_update_optional - (packageUpdateVersionID, package) - VALUES (?, ?)"; - $statement = WCF::getDB()->prepareStatement($sql); - WCF::getDB()->beginTransaction(); - foreach ($optionalInserts as $requirement) { - $statement->execute([ - $requirement['packageUpdateVersionID'], - $requirement['package'], - ]); - } - WCF::getDB()->commitTransaction(); - } - if (!empty($excludedPackagesParameters)) { $sql = "INSERT INTO wcf" . WCF_N . "_package_update_exclusion (packageUpdateVersionID, excludedPackage, excludedPackageVersion) diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index 98f7c4ff57..5a46f6fad4 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -1049,6 +1049,7 @@ CREATE TABLE wcf1_package_update_fromversion ( UNIQUE KEY packageUpdateVersionID (packageUpdateVersionID, fromversion) ); +-- @deprecated DROP TABLE IF EXISTS wcf1_package_update_optional; CREATE TABLE wcf1_package_update_optional ( packageUpdateVersionID INT(10) NOT NULL DEFAULT 0, -- 2.20.1