Do not store optional information from update servers within the database
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 3 Aug 2021 10:00:26 +0000 (12:00 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 3 Aug 2021 10:00:26 +0000 (12:00 +0200)
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

wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_clearPackageCompatibility.php [deleted file]
wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_clearPackageDeprecations.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php
wcfsetup/setup/db/install.sql

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_clearPackageCompatibility.php
deleted file mode 100644 (file)
index 389de51..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-/**
- * Clear the wcf1_package_(update_)?compatibility table.
- *
- * see https://github.com/WoltLab/WCF/pull/4371
- *
- * @author Tim Duesterhus
- * @copyright 2001-2021 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package WoltLabSuite\Core
- */
-
-use wcf\system\WCF;
-
-$sql = "DELETE FROM wcf1_package_compatibility";
-$statement = WCF::getDB()->prepare($sql);
-$statement->execute();
-
-$sql = "DELETE FROM wcf1_package_update_compatibility";
-$statement = WCF::getDB()->prepare($sql);
-$statement->execute();
diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_clearPackageDeprecations.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_clearPackageDeprecations.php
new file mode 100644 (file)
index 0000000..20d2c62
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+/**
+ * Clear the wcf1_package_(update_)?compatibility, wcf1_package_update_optional tables.
+ *
+ * see https://github.com/WoltLab/WCF/pull/4371
+ *
+ * @author Tim Duesterhus
+ * @copyright 2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core
+ */
+
+use wcf\system\WCF;
+
+$sql = "DELETE FROM wcf1_package_compatibility";
+$statement = WCF::getDB()->prepare($sql);
+$statement->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();
index 6e4fb2116785105dff0708ed6dca4aa278ab4269..d85eac39e95ad70d4d07eb1daea7be8ca63b38c2 100644 (file)
@@ -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)
index 98f7c4ff57e711c826aa3cfe1f84c85b52add0cb..5a46f6fad4986e9eb28cd4902d00b36ce09d69c4 100644 (file)
@@ -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,