From: Alexander Ebert Date: Wed, 13 Nov 2019 00:19:18 +0000 (+0100) Subject: Force exclusion of Core `6.0.0 Alpha 1` for packages with API compatibility X-Git-Tag: 5.2.0_Beta_3~2^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a0692a56b6838b2f9ea6b987fe0044a8022bdd28;p=GitHub%2FWoltLab%2FWCF.git Force exclusion of Core `6.0.0 Alpha 1` for packages with API compatibility --- 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)