+++ /dev/null
-<?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();
--- /dev/null
+<?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();
*/
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 (?, ?, ?, ?, ?, ?, ?, ?)";
}
}
- 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[] = [
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)