From a0692a56b6838b2f9ea6b987fe0044a8022bdd28 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 13 Nov 2019 01:19:18 +0100 Subject: [PATCH] Force exclusion of Core `6.0.0 Alpha 1` for packages with API compatibility --- .../package/PackageUpdateDispatcher.class.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php index f6f1711d15..1b9323280e 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php @@ -552,6 +552,7 @@ class PackageUpdateDispatcher extends SingletonFactory { } // register compatibility versions of this update package version. + // @deprecated 5.2 if (isset($versionData['compatibility'])) { foreach ($versionData['compatibility'] as $version) { $compatibilityInserts[] = [ @@ -559,6 +560,31 @@ class PackageUpdateDispatcher extends SingletonFactory { 'version' => $version ]; } + + // The API compatibility versions are deprecated, any package that exposes them must + // exclude at most `com.woltlab.wcf` in version `6.0.0 Alpha 1`. + if (!empty($compatibilityInserts)) { + if (!isset($versionData['excludedPackages'])) $versionData['excludedPackages'] = []; + $excludeCore60 = '6.0.0 Alpha 1'; + + $coreExclude = null; + $versionData['excludedPackages'] = array_filter($versionData['excludedPackages'], function($excludedPackage) use (&$coreExclude) { + if ($excludedPackage['excludedPackage'] === 'com.woltlab.wcf') { + $coreExclude = $excludedPackage['excludedPackageVersion']; + return false; + } + + return true; + }); + + if ($coreExclude === null || Package::compareVersion($coreExclude, $excludeCore60, '>')) { + $versionData['excludedPackages'][] = [ + 'packageUpdateVersionID' => $packageUpdateVersionID, + 'excludedPackage' => 'com.woltlab.wcf', + 'excludedPackageVersion' => $excludeCore60, + ]; + } + } } } } @@ -633,6 +659,7 @@ class PackageUpdateDispatcher extends SingletonFactory { } // insert compatibility versions + // @deprecated 5.2 if (!empty($compatibilityInserts)) { $sql = "INSERT INTO wcf".WCF_N."_package_update_compatibility (packageUpdateVersionID, version) -- 2.20.1