From: Alexander Ebert Date: Sun, 28 Jun 2015 16:30:12 +0000 (+0200) Subject: Backport ObjectTypeCache improvement X-Git-Tag: 2.1.5~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e74561b129a7c1f34122e66a959c8d77cec41c57;p=GitHub%2FWoltLab%2FWCF.git Backport ObjectTypeCache improvement --- diff --git a/wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php b/wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php index 928c9e5c55..1dbeb1aa56 100644 --- a/wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php +++ b/wcfsetup/install/files/lib/data/object/type/ObjectTypeCache.class.php @@ -57,14 +57,7 @@ class ObjectTypeCache extends SingletonFactory { // get object type cache $this->objectTypes = ObjectTypeCacheBuilder::getInstance()->getData(array(), 'objectTypes'); - foreach ($this->objectTypes as $objectType) { - $definition = $this->getDefinition($objectType->definitionID); - if (!isset($this->groupedObjectTypes[$definition->definitionName])) { - $this->groupedObjectTypes[$definition->definitionName] = array(); - } - - $this->groupedObjectTypes[$definition->definitionName][$objectType->objectType] = $objectType; - } + $this->groupedObjectTypes = ObjectTypeCacheBuilder::getInstance()->getData(array(), 'groupedObjectTypes'); } /** diff --git a/wcfsetup/install/files/lib/system/cache/builder/ObjectTypeCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/ObjectTypeCacheBuilder.class.php index e6ef706360..45e97a3b72 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/ObjectTypeCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/ObjectTypeCacheBuilder.class.php @@ -22,7 +22,8 @@ class ObjectTypeCacheBuilder extends AbstractCacheBuilder { $data = array( 'categories' => array(), 'definitions' => array(), - 'objectTypes' => array() + 'objectTypes' => array(), + 'groupedObjectTypes' => array() ); // get definitions @@ -48,7 +49,11 @@ class ObjectTypeCacheBuilder extends AbstractCacheBuilder { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); while ($row = $statement->fetchArray()) { - $data['objectTypes'][$row['objectTypeID']] = new ObjectType(null, $row); + $data['objectTypes'][$row['objectTypeID']] = $objectType = new ObjectType(null, $row); + + $definition = $data['definitions'][$objectType->definitionID]; + if (!isset($data['groupedObjectTypes'][$definition->definitionName])) $data['groupedObjectTypes'][$definition->definitionName] = array(); + $data['groupedObjectTypes'][$definition->definitionName][$objectType->objectType] = $objectType; } return $data;