From 0e8af3effdbb51d4b1901c63539ae539adb59135 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 12 Nov 2019 20:53:49 +0100 Subject: [PATCH] Deprecate the API versions, implicit exclusion of `6.0.0 Alpha 1` --- .../install/files/acp/templates/index.tpl | 10 ------- .../install/files/lib/system/WCF.class.php | 4 +++ .../system/package/PackageArchive.class.php | 28 +++++++++++++++++++ .../PackageValidationArchive.class.php | 4 +-- .../PackageValidationException.class.php | 3 ++ 5 files changed, 36 insertions(+), 13 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/index.tpl b/wcfsetup/install/files/acp/templates/index.tpl index 1eb306a858..5c53f43d48 100644 --- a/wcfsetup/install/files/acp/templates/index.tpl +++ b/wcfsetup/install/files/acp/templates/index.tpl @@ -87,16 +87,6 @@
{lang}wcf.acp.index.system.software.version{/lang}
{@WCF_VERSION}
-
-
{lang}wcf.acp.index.system.software.apiVersion{/lang}
-
{@WSC_API_VERSION}
-
- {if !$__wcf->getSupportedLegacyApiVersions()|empty} -
-
{lang}wcf.acp.index.system.software.legacyApiVersions{/lang}
-
{implode from=$__wcf->getSupportedLegacyApiVersions() item=version glue=', '}{$version}{/implode}
-
- {/if} {event name='softwareFields'} diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index fc9616079f..db8d1c4789 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -52,6 +52,7 @@ if (!@ini_get('date.timezone')) { define('WCF_VERSION', '5.2.0 Beta 3'); // define current API version +// @deprecated 5.2 define('WSC_API_VERSION', 2019); // define current unix timestamp @@ -76,6 +77,7 @@ class WCF { /** * list of supported legacy API versions * @var integer[] + * @deprecated 5.2 */ private static $supportedLegacyApiVersions = [2017, 2018]; @@ -1108,6 +1110,7 @@ class WCF { * * @param integer $apiVersion * @return boolean + * @deprecated 5.2 */ public static function isSupportedApiVersion($apiVersion) { return ($apiVersion == WSC_API_VERSION) || in_array($apiVersion, self::$supportedLegacyApiVersions); @@ -1117,6 +1120,7 @@ class WCF { * Returns the list of supported legacy API versions. * * @return integer[] + * @deprecated 5.2 */ public static function getSupportedLegacyApiVersions() { return self::$supportedLegacyApiVersions; diff --git a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php index af0a5e22cd..e67a9b5c41 100644 --- a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php @@ -69,6 +69,7 @@ class PackageArchive { /** * list of compatible API versions * @var integer[] + * @deprecated 5.2 */ protected $compatibility = []; @@ -301,6 +302,32 @@ class PackageArchive { $this->compatibility[] = $version; } + // API compatibility implies an exclude of `com.woltlab.wcf` in version `6.0.0 Alpha 1`, unless a lower version is explicitly excluded. + if (!empty($this->compatibility)) { + $excludeCore60 = '6.0.0 Alpha 1'; + + $coreExclude = ''; + foreach ($this->excludedPackages as $excludedPackage) { + if ($excludedPackage['name'] === 'com.woltlab.wcf') { + $coreExclude = $excludedPackage['version']; + break; + } + } + + if (!$coreExclude || Package::compareVersion($coreExclude, $excludeCore60, '>')) { + if ($coreExclude) { + $this->excludedPackages = array_filter($this->excludedPackages, function($exclude) { + return $exclude['name'] !== 'com.woltlab.wcf'; + }); + } + + $this->excludedPackages[] = [ + 'name' => 'com.woltlab.wcf', + 'version' => $excludeCore60, + ]; + } + } + // get instructions $elements = $xpath->query('./ns:instructions', $package); foreach ($elements as $element) { @@ -554,6 +581,7 @@ class PackageArchive { * Returns the list of compatible API versions. * * @return integer[] + * @deprecated 5.2 */ public function getCompatibleVersions() { return $this->compatibility; diff --git a/wcfsetup/install/files/lib/system/package/validation/PackageValidationArchive.class.php b/wcfsetup/install/files/lib/system/package/validation/PackageValidationArchive.class.php index cb5625553d..5b32ec9a36 100644 --- a/wcfsetup/install/files/lib/system/package/validation/PackageValidationArchive.class.php +++ b/wcfsetup/install/files/lib/system/package/validation/PackageValidationArchive.class.php @@ -216,9 +216,7 @@ class PackageValidationArchive implements \RecursiveIterator { throw new PackageValidationException(PackageValidationException::INCOMPATIBLE_API_VERSION, ['isOlderVersion' => $isOlderVersion]); } } - else if (ENABLE_DEBUG_MODE && ENABLE_DEVELOPER_TOOLS && ($package === null || $package->package !== 'com.woltlab.wcf')) { - throw new PackageValidationException(PackageValidationException::MISSING_API_VERSION); - } + // Missing details on API compatibility are no longer an error. // package is not installed yet if ($package === null) { diff --git a/wcfsetup/install/files/lib/system/package/validation/PackageValidationException.class.php b/wcfsetup/install/files/lib/system/package/validation/PackageValidationException.class.php index 376cc7a57b..4f01326166 100644 --- a/wcfsetup/install/files/lib/system/package/validation/PackageValidationException.class.php +++ b/wcfsetup/install/files/lib/system/package/validation/PackageValidationException.class.php @@ -96,18 +96,21 @@ class PackageValidationException extends SystemException { /** * the provided API version string is invalid and does not fall into the range from `2017` through `2099` * @var integer + * @deprecated 5.2 */ const INVALID_API_VERSION = 13; /** * the package is not compatible with the current API version or any other of the supported ones * @var integer + * @deprecated 5.2 */ const INCOMPATIBLE_API_VERSION = 14; /** * the package lacks any sort of API compatibility data * @var integer + * @deprecated 5.2 */ const MISSING_API_VERSION = 15; -- 2.20.1