Use a static list to expose compatible API versions
authorAlexander Ebert <ebert@woltlab.com>
Tue, 23 Jan 2018 17:34:05 +0000 (18:34 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 23 Jan 2018 17:34:11 +0000 (18:34 +0100)
wcfsetup/install/files/lib/data/style/StyleEditor.class.php

index 2283ec34f713ba2fc57ddc36b64b221cf5dbe47d..9552547b670b3e3b2c3fc3e0d84f730d3d1da2f5 100644 (file)
@@ -40,9 +40,18 @@ use wcf\util\XMLWriter;
  * @mixin      Style
  */
 class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject {
+       /**
+        * @deprecated 3.1 use the compatibility api versions instead
+        */
        const EXCLUDE_WCF_VERSION = '3.2.0 Alpha 1';
        const INFO_FILE = 'style.xml';
        
+       /**
+        * list of compatible API versions
+        * @var integer[]
+        */
+       public static $compatibilityApiVersions = [2018];
+       
        /**
         * @inheritDoc
         */
@@ -888,7 +897,9 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
                        $xml->endElement();
                        
                        $xml->startElement('compatibility');
-                       $xml->writeElement('api', '', ['version' => 2018]);
+                       foreach (self::$compatibilityApiVersions as $apiVersion) {
+                               $xml->writeElement('api', '', ['version' => $apiVersion]);
+                       }
                        $xml->endElement();
                        
                        $xml->startElement('instructions', ['type' => 'install']);