Removed validation of object type existence
authorAlexander Ebert <ebert@woltlab.com>
Sun, 27 Jan 2013 15:32:00 +0000 (16:32 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 27 Jan 2013 15:32:00 +0000 (16:32 +0100)
We explicitly want to allow option types to be provided by an application, but the current system does not allow bogus autoload paths to be registered on runtime. Since a bad object type is a developer's fault we can safely ignore it here. If it fails, blame him.

wcfsetup/install/files/lib/system/package/plugin/OptionPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/UserOptionPackageInstallationPlugin.class.php

index 6e80df3df835035bc897ba2dd3ce9106bbeb27f1..8d277eb9ad1221a06d8ef8d2c024c190d909f481 100644 (file)
@@ -59,11 +59,6 @@ class OptionPackageInstallationPlugin extends AbstractOptionPackageInstallationP
                if (isset($option['supporti18n'])) $supportI18n = $option['supporti18n'];
                if (isset($option['requirei18n'])) $requireI18n = $option['requirei18n'];
                
-               // check if optionType exists
-               if (!$this->validateOptionType($optionType)) {
-                       throw new SystemException("unable to find option type '".$optionType."'");
-               }
-               
                // collect additional tags and their values
                $additionalData = array();
                foreach ($option as $tag => $value) {
@@ -116,39 +111,4 @@ class OptionPackageInstallationPlugin extends AbstractOptionPackageInstallationP
                        $optionEditor->update($data);
                }
        }
-       
-       /**
-        * Returns true, if option type is valid.
-        * 
-        * @param       integer         $optionType
-        * @return      boolean
-        */
-       protected function validateOptionType($optionType) {
-               $optionType = StringUtil::firstCharToUpperCase($optionType);
-               
-               // attempt to validate against WCF first
-               $className = 'wcf\system\option\\'.$optionType.'OptionType';
-               if (class_exists($className)) {
-                       return true;
-               }
-               
-               // check for applications
-               if (self::$abbreviations === null) {
-                       self::$abbreviations = array();
-                       
-                       $applications = ApplicationHandler::getInstance()->getApplications();
-                       foreach ($applications as $application) {
-                               self::$abbreviations[] = ApplicationHandler::getInstance()->getAbbreviation($application->packageID);
-                       }
-               }
-               
-               foreach (self::$abbreviations as $abbreviation) {
-                       $className = $abbreviation.'\system\option\\'.$optionType.'OptionType';
-                       if (class_exists($className)) {
-                               return true;
-                       }
-               }
-               
-               return false;
-       }
 }
index 31508e84db4ba89088ffa58a1383d2cdf1c50bf4..fa6e963e87d25eb811ffcfc8b1f81bdf0aa6875e 100644 (file)
@@ -62,12 +62,6 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst
                if (isset($option['permissions'])) $permissions = $option['permissions'];
                if (isset($option['options'])) $options = $option['options'];
                
-               // check if optionType exists
-               $className = 'wcf\system\option\user\group\\'.StringUtil::firstCharToUpperCase($optionType).'UserGroupOptionType';
-               if (!class_exists($className)) {
-                       throw new SystemException("unable to find class '".$className."'");
-               }
-               
                // collect additional tags and their values
                $additionalData = array();
                foreach ($option as $tag => $value) {
index 23677bac6dd090ab7f04114d59a20aaee4c7fcff..149759b3a77fb78b91fdf8e7e05f3233e64fa328 100644 (file)
@@ -85,12 +85,6 @@ class UserOptionPackageInstallationPlugin extends AbstractOptionPackageInstallat
                if (isset($option['permissions'])) $permissions = $option['permissions'];
                if (isset($option['options'])) $options = $option['options'];
                
-               // check if optionType exists
-               $className = 'wcf\system\option\\'.StringUtil::firstCharToUpperCase($optionType).'OptionType';
-               if (!class_exists($className)) {
-                       throw new SystemException("unable to find class '".$className."'");
-               }
-               
                // collect additional tags and their values
                $additionalData = array();
                foreach ($option as $tag => $value) {