Deprecate the API versions, implicit exclusion of `6.0.0 Alpha 1`
authorAlexander Ebert <ebert@woltlab.com>
Tue, 12 Nov 2019 19:53:49 +0000 (20:53 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 12 Nov 2019 19:53:49 +0000 (20:53 +0100)
wcfsetup/install/files/acp/templates/index.tpl
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/package/PackageArchive.class.php
wcfsetup/install/files/lib/system/package/validation/PackageValidationArchive.class.php
wcfsetup/install/files/lib/system/package/validation/PackageValidationException.class.php

index 1eb306a85847beecdaf0c4ef012c0f38d43be866..5c53f43d48f052f907b85dc8997f8265f0434fce 100644 (file)
                                <dt>{lang}wcf.acp.index.system.software.version{/lang}</dt>
                                <dd>{@WCF_VERSION}</dd>
                        </dl>
-                       <dl>
-                               <dt>{lang}wcf.acp.index.system.software.apiVersion{/lang}</dt>
-                               <dd>{@WSC_API_VERSION}</dd>
-                       </dl>
-                       {if !$__wcf->getSupportedLegacyApiVersions()|empty}
-                               <dl>
-                                       <dt>{lang}wcf.acp.index.system.software.legacyApiVersions{/lang}</dt>
-                                       <dd><small>{implode from=$__wcf->getSupportedLegacyApiVersions() item=version glue=', '}{$version}{/implode}</small></dd>
-                               </dl>
-                       {/if}
                        
                        {event name='softwareFields'}
                        
index fc9616079f3c2dab5601b343aa03dec90666e5f6..db8d1c4789c5f55350c2e5d616a90aa30bf03e07 100644 (file)
@@ -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;
index af0a5e22cd3f09b8f162cad11bca036a5c8a8977..e67a9b5c41fe4ae3e6a5554b471f3a9051decec9 100644 (file)
@@ -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;
index cb5625553de2fe43712832672ba79a6ea992aa2b..5b32ec9a368658041e901d1d413f9d9a69e5412f 100644 (file)
@@ -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) {
index 376cc7a57b836b02eff5ebb86c0181735c7f5826..4f01326166ca3e02663f44171dc7081b7a67dd22 100644 (file)
@@ -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;