From: Alexander Ebert Date: Tue, 8 Nov 2011 11:32:27 +0000 (+0100) Subject: Option cache builder supports various objects X-Git-Tag: 2.0.0_Beta_1~1616^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a10328f6849d15275f0e2a008e3cadf41f96dcaf;p=GitHub%2FWoltLab%2FWCF.git Option cache builder supports various objects --- diff --git a/wcfsetup/install/files/lib/system/cache/builder/OptionCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/OptionCacheBuilder.class.php index 04700e508a..5e8d82cb32 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/OptionCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/OptionCacheBuilder.class.php @@ -91,6 +91,19 @@ class OptionCacheBuilder implements ICacheBuilder { } if (count($optionIDs) > 0) { + // get option class from type + $className = 'wcf\data\option\Option'; + if (!empty($type)) { + preg_match_all('~((?:^|[A-Z])[a-z]+)~', $type, $matches); + if (isset($matches[1])) { + $className = 'wcf\data\\'; + for ($i = 0, $length = sizeof($matches[1]); $i < $length; $i++) { + $className .= $matches[1][$i] . '\\'; + } + $className .= ucfirst($type); + } + } + // get needed options $conditions = new PreparedStatementConditionBuilder(); $conditions->add("optionID IN (?)", array($optionIDs)); @@ -102,7 +115,7 @@ class OptionCacheBuilder implements ICacheBuilder { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditions->getParameters()); while ($row = $statement->fetchArray()) { - $data['options'][$row['optionName']] = new Option(null, $row); + $data['options'][$row['optionName']] = new $className(null, $row); if (!isset($data['optionToCategories'][$row['categoryName']])) { $data['optionToCategories'][$row['categoryName']] = array(); }