CacheBuilder get their own folder/namespace
authorMatthias Schmidt <gravatronics@live.com>
Wed, 20 Jul 2011 14:53:09 +0000 (16:53 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 20 Jul 2011 14:53:09 +0000 (16:53 +0200)
Like I suggested here http://www.woltlab.com/bugtracker/index.php?page=B
ug&bugID=1304, CacheBuilder get their own folder and now also own namesp
ace like the event listeners.

58 files changed:
wcfsetup/install/files/lib/acp/form/AbstractOptionListForm.class.php
wcfsetup/install/files/lib/acp/page/UserListPage.class.php
wcfsetup/install/files/lib/data/style/ActiveStyle.class.php
wcfsetup/install/files/lib/data/user/User.class.php
wcfsetup/install/files/lib/data/user/group/UserGroup.class.php
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/WCFACP.class.php
wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php
wcfsetup/install/files/lib/system/cache/CacheBuilderACPMenu.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderApplication.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderCleanupAdapter.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderCoreObject.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderCronjob.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderEventListener.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderIcon.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderLanguage.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderOption.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderPackage.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderPackageDependency.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderPageMenu.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderSpider.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderStyle.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderTemplate.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderTemplateGroup.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderTemplateListener.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderTemplateListenerCode.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderUserGroup.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/CacheBuilderUserGroupPermission.class.php [deleted file]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderACPMenu.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderApplication.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderCleanupAdapter.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderCoreObject.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderCronjob.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderEventListener.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderIcon.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderLanguage.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderOption.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderPackage.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderPackageDependency.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderPageMenu.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderSpider.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderStyle.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplate.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplateGroup.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplateListener.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplateListenerCode.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderUserGroup.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cache/builder/CacheBuilderUserGroupPermission.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/cleanup/CleanupHandler.class.php
wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php
wcfsetup/install/files/lib/system/event/EventHandler.class.php
wcfsetup/install/files/lib/system/language/LanguageFactory.class.php
wcfsetup/install/files/lib/system/menu/acp/ACPMenu.class.php
wcfsetup/install/files/lib/system/menu/page/PageMenu.class.php
wcfsetup/install/files/lib/system/package/PackageDependencyHandler.class.php
wcfsetup/install/files/lib/system/session/SessionHandler.class.php
wcfsetup/install/files/lib/system/style/StyleHandler.class.php
wcfsetup/install/files/lib/system/template/TemplateEngine.class.php

index 8085e4b0e9cc6f834725015a3c51f0bbfa5461e4..96b88e17c9216cd68ba24dabb87f28be55b0b100 100755 (executable)
@@ -38,7 +38,7 @@ abstract class AbstractOptionListForm extends AbstractForm {
         * cache class name\r
         * @var string\r
         */\r
-       public $cacheClass = 'wcf\system\cache\CacheBuilderOption';\r
+       public $cacheClass = 'wcf\system\cache\builder\CacheBuilderOption';\r
 \r
        /**\r
         * list of all option categories\r
index 7ec60a4510a4f8da2e2422e0d6b3fe48abf46563..b24a85ce9d47d6a676c6716b34dfe68d227c69a0 100755 (executable)
@@ -258,7 +258,7 @@ class UserListPage extends SortablePage {
        protected function readUserOptions() {\r
                // add cache resource\r
                $cacheName = 'user-option-'.PACKAGE_ID;\r
-               CacheHandler::getInstance()->addResource($cacheName, WCF_DIR.'cache/cache.'.$cacheName.'.php', 'wcf\system\cache\CacheBuilderOption');\r
+               CacheHandler::getInstance()->addResource($cacheName, WCF_DIR.'cache/cache.'.$cacheName.'.php', 'wcf\system\cache\builder\CacheBuilderOption');\r
                \r
                // get options\r
                $this->options = CacheHandler::getInstance()->get($cacheName, 'options');\r
index e8a33271dba3fde8cfa395f09f209e6d4b713e19..2d94ee9ab3de720723312ca7da5fec279f69089d 100644 (file)
@@ -41,7 +41,7 @@ class ActiveStyle extends DatabaseObjectDecorator {
                }
                
                // load icon cache
-               WCF::getCache()->addResource('icon-'.PACKAGE_ID.'-'.$this->styleID, WCF_DIR.'cache/cache.icon-'.PACKAGE_ID.'-'.$this->styleID.'.php', 'wcf\system\cache\CacheBuilderIcon');
+               WCF::getCache()->addResource('icon-'.PACKAGE_ID.'-'.$this->styleID, WCF_DIR.'cache/cache.icon-'.PACKAGE_ID.'-'.$this->styleID.'.php', 'wcf\system\cache\builder\CacheBuilderIcon');
                $this->iconCache = WCF::getCache()->get('icon-'.PACKAGE_ID.'-'.$this->styleID);
        }
        
index 944b89188146fd4486659d32ee7fa27bbf730394..52e65854164843ae3738644b69deb02e9753b273 100644 (file)
@@ -174,7 +174,7 @@ class User extends DatabaseObject {
         */
        protected static function getUserOptionCache() {
                $cacheName = 'user-option-'.PACKAGE_ID;
-               CacheHandler::getInstance()->addResource($cacheName, WCF_DIR.'cache/cache.'.$cacheName.'.php', 'wcf\system\cache\CacheBuilderOption');
+               CacheHandler::getInstance()->addResource($cacheName, WCF_DIR.'cache/cache.'.$cacheName.'.php', 'wcf\system\cache\builder\CacheBuilderOption');
                self::$userOptions = CacheHandler::getInstance()->get($cacheName, 'options');
        }
        
index a6e1705e9e164b9426775ba1a22c442c471c817a..39810f480cd2eba50e73719b9aeab0214eca3434 100644 (file)
@@ -193,7 +193,7 @@ class UserGroup extends DatabaseObject {
         */
        protected static function getCache() {
                if (self::$cache === null) {
-                       CacheHandler::getInstance()->addResource('usergroups', WCF_DIR.'cache/cache.usergroups.php', 'wcf\system\cache\CacheBuilderUserGroup');
+                       CacheHandler::getInstance()->addResource('usergroups', WCF_DIR.'cache/cache.usergroups.php', 'wcf\system\cache\builder\CacheBuilderUserGroup');
                        self::$cache = CacheHandler::getInstance()->get('usergroups');
                }
        }
index ab74b4e79b4e82bc2db9b3c10ec83c17a4520f9a..8eb198cb5b8c69fa4ea8cd567d20a0fa570e30a0 100644 (file)
@@ -297,10 +297,10 @@ class WCF {
         * Loads the default cache resources.\r
         */\r
        protected function loadDefaultCacheResources() {\r
-               CacheHandler::getInstance()->addResource('languages', WCF_DIR.'cache/cache.languages.php', 'wcf\system\cache\CacheBuilderLanguage');\r
-               CacheHandler::getInstance()->addResource('spiders', WCF_DIR.'cache/cache.spiders.php', 'wcf\system\cache\CacheBuilderSpider');\r
+               CacheHandler::getInstance()->addResource('languages', WCF_DIR.'cache/cache.languages.php', 'wcf\system\cache\builder\CacheBuilderLanguage');\r
+               CacheHandler::getInstance()->addResource('spiders', WCF_DIR.'cache/cache.spiders.php', 'wcf\system\builder\cache\CacheBuilderSpider');\r
                if (defined('PACKAGE_ID')) {\r
-                       CacheHandler::getInstance()->addResource('coreObjects-'.PACKAGE_ID, WCF_DIR.'cache/cache.coreObjects-'.PACKAGE_ID.'.php', 'wcf\system\cache\CacheBuilderCoreObject');\r
+                       CacheHandler::getInstance()->addResource('coreObjects-'.PACKAGE_ID, WCF_DIR.'cache/cache.coreObjects-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\CacheBuilderCoreObject');\r
                }\r
        }\r
        \r
@@ -561,4 +561,4 @@ class WCF {
                \r
                return null;\r
        }\r
-}
+}\r
index 0fb2656dcdf2a56ec11d8d3bec9fccdbb667dfd0..504a09459e0b9f99c4c60b16a0055fa8dcbcd446 100644 (file)
@@ -93,7 +93,7 @@ class WCFACP extends WCF {
         */\r
        protected function loadDefaultCacheResources() {\r
                parent::loadDefaultCacheResources();\r
-               CacheHandler::getInstance()->addResource('packages', WCF_DIR.'cache/cache.packages.php', 'wcf\system\cache\CacheBuilderPackage');\r
+               CacheHandler::getInstance()->addResource('packages', WCF_DIR.'cache/cache.packages.php', 'wcf\system\cache\builder\CacheBuilderPackage');\r
        }\r
        \r
        /**\r
@@ -174,4 +174,4 @@ class WCFACP extends WCF {
                        }\r
                }\r
        }\r
-}
+}\r
index 8c851b0bad0202e3674e32bcc082e11ecfdf4809..9e569c001a285dda357f8c951a410eda7a2ef599 100644 (file)
@@ -28,7 +28,7 @@ class ApplicationHandler extends SingletonFactory {
                CacheHandler::getInstance()->addResource(
                        'application-'.PACKAGE_ID,
                        WCF_DIR.'cache/cache.application-'.PACKAGE_ID.'.php',
-                       'wcf\system\cache\CacheBuilderApplication'
+                       'wcf\system\cache\builder\CacheBuilderApplication'
                );
                $this->cache = CacheHandler::getInstance()->get('application-'.PACKAGE_ID);
        }
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderACPMenu.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderACPMenu.class.php
deleted file mode 100644 (file)
index 5929756..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-<?php\r
-namespace wcf\system\cache;\r
-use wcf\data\acp\menu\item\ACPMenuItem;\r
-use wcf\system\database\util\PreparedStatementConditionBuilder;\r
-use wcf\system\WCF;\r
-\r
-/**\r
- * Caches the acp menu items tree.\r
- * \r
- * @author     Marcel Werk\r
- * @copyright  2001-2011 WoltLab GmbH\r
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
- * @package    com.woltlab.wcf\r
- * @subpackage system.cache\r
- * @category   Community Framework\r
- */\r
-class CacheBuilderACPMenu implements CacheBuilder {\r
-       protected $optionCategoryStructure = array();\r
-\r
-       /**\r
-        * @see CacheBuilder::getData()\r
-        */\r
-       public function getData($cacheResource) {\r
-               list($cache, $packageID) = explode('-', $cacheResource['cache']); \r
-               $data = array();\r
-\r
-               // get all menu items and filter menu items with low priority\r
-               $sql = "SELECT          menuItem, menuItemID\r
-                       FROM            wcf".WCF_N."_acp_menu_item menu_item\r
-                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
-                       ON              (menu_item.packageID = package_dependency.dependency)\r
-                       WHERE           package_dependency.packageID = ?\r
-                       ORDER BY        package_dependency.priority ASC";\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute(array($packageID));\r
-               $itemIDs = array();\r
-               while ($row = $statement->fetchArray()) {\r
-                       $itemIDs[$row['menuItem']] = $row['menuItemID'];\r
-               }\r
-               \r
-               if (count($itemIDs) > 0) {\r
-                       $conditions = new PreparedStatementConditionBuilder();\r
-                       $conditions->add("menuItemID IN (?)", array($itemIDs));\r
-                       \r
-                       // get needed menu items and build item tree\r
-                       $sql = "SELECT          menu_item.packageID, menuItem, parentMenuItem,\r
-                                               menuItemLink, permissions, options, packageDir\r
-                               FROM            wcf".WCF_N."_acp_menu_item menu_item\r
-                               LEFT JOIN       wcf".WCF_N."_package package\r
-                               ON              (package.packageID = menu_item.packageID)\r
-                               ".$conditions."\r
-                               ORDER BY        showOrder ASC";\r
-                       $statement = WCF::getDB()->prepareStatement($sql);\r
-                       $statement->execute($conditions->getParameters());\r
-                       while ($row = $statement->fetchArray()) {\r
-                               if (!isset($data[$row['parentMenuItem']])) {\r
-                                       $data[$row['parentMenuItem']] = array();\r
-                               }\r
-                               \r
-                               $data[$row['parentMenuItem']][] = new ACPMenuItem(null, $row);\r
-                       }\r
-               }\r
-               \r
-               // get top option categories\r
-               $optionCategories = $this->getTopOptionCategories($packageID);\r
-               if (count($optionCategories) > 0) {\r
-                       if (!isset($data['wcf.acp.menu.link.option.category'])) {\r
-                               $data['wcf.acp.menu.link.option.category'] = array();\r
-                       }\r
-                       \r
-                       // get option category data\r
-                       $conditions = new PreparedStatementConditionBuilder();\r
-                       $conditions->add("categoryID IN (?)", array($optionCategories));\r
-                       \r
-                       $sql = "SELECT          *\r
-                               FROM            wcf".WCF_N."_option_category\r
-                               ".$conditions."\r
-                               ORDER BY        showOrder ASC";\r
-                       $statement = WCF::getDB()->prepareStatement($sql);\r
-                       $statement->execute($conditions->getParameters());\r
-                       while ($row = $statement->fetchArray()) {\r
-                               $data['wcf.acp.menu.link.option.category'][] = new ACPMenuItem(null, array(\r
-                                       'packageID' => $packageID,\r
-                                       'menuItem' => 'wcf.acp.option.category.'.$row['categoryName'],\r
-                                       'parentMenuItem' => 'wcf.acp.menu.link.option.category',\r
-                                       'menuItemLink' => 'index.php?form=Option&categoryID='.$row['categoryID'],\r
-                                       'packageDir' => '',\r
-                                       'permissions' => $row['permissions'],\r
-                                       'options' => $row['options']\r
-                               ));\r
-                       }\r
-               }\r
-               \r
-               return $data;\r
-       }\r
-       \r
-       protected function getTopOptionCategories($packageID) {\r
-               // get all option categories and filter categories with low priority\r
-               $sql = "SELECT          categoryName, categoryID \r
-                       FROM            wcf".WCF_N."_option_category option_category\r
-                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
-                       ON              (package_dependency.dependency = option_category.packageID)\r
-                       WHERE           package_dependency.packageID = ?\r
-                       ORDER BY        package_dependency.priority ASC";\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute(array($packageID));\r
-               $optionCategories = array();\r
-               while ($row = $statement->fetchArray()) {\r
-                       $optionCategories[$row['categoryName']] = $row['categoryID'];\r
-               }\r
-               \r
-               $conditions = new PreparedStatementConditionBuilder();\r
-               $conditions->add("categoryID IN (?)", array($optionCategories));\r
-               $statementParameters = $conditions->getParameters();\r
-               array_unshift($statementParameters, $packageID);\r
-               \r
-               $sql = "SELECT          categoryID, parentCategoryName, categoryName,\r
-                                       (\r
-                                               SELECT COUNT(*) FROM wcf".WCF_N."_option WHERE categoryName = category.categoryName AND packageID IN (\r
-                                                       SELECT dependency FROM wcf".WCF_N."_package_dependency WHERE packageID = ?\r
-                                               )\r
-                                       ) AS count\r
-                       FROM            wcf".WCF_N."_option_category category\r
-                       ".$conditions;\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute($statementParameters);\r
-               while ($row = $statement->fetchArray()) {\r
-                       if (!isset($this->optionCategoryStructure[$row['parentCategoryName']])) $this->optionCategoryStructure[$row['parentCategoryName']] = array();\r
-                       $this->optionCategoryStructure[$row['parentCategoryName']][] = $row;\r
-               }\r
-               \r
-               $topOptionCategories = array();\r
-               foreach ($this->optionCategoryStructure[''] as $optionCategory) {\r
-                       $count = $optionCategory['count'] + $this->countOptions($optionCategory['categoryName']);\r
-                       if ($count > 0) $topOptionCategories[] = $optionCategory['categoryID'];\r
-               }\r
-               \r
-               return $topOptionCategories;\r
-       }\r
-       \r
-       protected function countOptions($parentCategoryName) {\r
-               if (!isset($this->optionCategoryStructure[$parentCategoryName])) return 0;\r
-               \r
-               $count = 0;\r
-               foreach ($this->optionCategoryStructure[$parentCategoryName] as $optionCategory) {\r
-                       $count += $optionCategory['count'] + $this->countOptions($optionCategory['categoryName']);\r
-               }\r
-               \r
-               return $count;\r
-       }\r
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderApplication.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderApplication.class.php
deleted file mode 100644 (file)
index 14e5b10..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-namespace wcf\system\cache;
-use wcf\data\application\group\ApplicationGroup;
-use wcf\data\application;
-use wcf\data\package\Package;
-use wcf\data\package\PackageList;
-use wcf\system\WCF;
-
-/**
- * Caches applications.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cache
- * @category   Community Framework
- */
-class CacheBuilderApplication implements CacheBuilder {
-       /**
-        * @see CacheBuilder::getData()
-        */
-       public function getData($cacheResource) {
-               list($cache, $packageID) = explode('-', $cacheResource['cache']);
-               $data = array(
-                       'abbreviation' => array(),
-                       'application' => array(),
-                       'group' => null,
-                       'primary' => 0,
-                       'wcf' => null
-               );
-               
-               // lookup group id for currently active application
-               $sql = "SELECT  groupID
-                       FROM    wcf".WCF_N."_application
-                       WHERE   packageID = ?";
-               $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute(array($packageID));
-               $row = $statement->fetchArray();
-               
-               // current application is not part of an application group
-               if (!$row || ($row['groupID'] == 0) || $row['groupID'] === null) {
-                       $data['application'] = array($packageID => new application\Application($packageID));
-               }
-               else {
-                       // fetch applications
-                       $applicationList = new application\ApplicationList();
-                       $applicationList->getConditionBuilder()->add("application.groupID = ?", array($row['groupID']));
-                       $applicationList->sqlLimit = 0;
-                       $applicationList->readObjects();
-                       $applications = $applicationList->getObjects();
-                       
-                       foreach ($applications as $application) {
-                               $data['application'][$application->packageID] = $application;
-                               
-                               // save primary application's package id
-                               if ($application->isPrimary) {
-                                       $data['primary'] = $application->packageID;
-                               }
-                       }
-                       
-                       // fetch application group
-                       $data['group'] = new ApplicationGroup($row['groupID']);
-               }
-               
-               // fetch abbreviations
-               $packageList = new PackageList();
-               $packageList->getConditionBuilder()->add('packageID IN (?)', array(array_keys($data['application'])));
-               $packageList->readObjects();
-               foreach ($packageList->getObjects() as $package) {
-                       $data['abbreviation'][Package::getAbbreviation($package->package)] = $package->packageID;
-               }
-               
-               // fetch wcf pseudo-application
-               $data['wcf'] = new application\Application(1);
-               
-               return $data;
-       }
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderCleanupAdapter.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderCleanupAdapter.class.php
deleted file mode 100644 (file)
index dff2a2b..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-namespace wcf\system\cache;
-use wcf\system\WCF;
-
-/**
- * Caches cleanup adapters.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cache
- * @category   Community Framework
- */
-class CacheBuilderCleanupAdapter implements CacheBuilder {
-       /**
-        * @see CacheBuilder::getData()
-        */
-       public function getData($cacheResource) {
-               list($cache, $packageID) = explode('-', $cacheResource['cache']);
-               $data = array(
-                       'adapters' => array(),
-                       'objectTypes' => array(),
-                       'packageIDs' => array()
-               );
-               
-               $sql = "SELECT          listener.*, package.packageDir
-                       FROM            wcf".WCF_N."_cleanup_listener listener
-                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency
-                       ON              (package_dependency.dependency = listener.packageID)
-                       LEFT JOIN       wcf".WCF_N."_package package
-                       ON              (package.packageID = listener.packageID)
-                       WHERE           package_dependency.packageID = ?
-                       ORDER BY        package_dependency.priority ASC";
-               $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute(array($packageID));
-               while ($row = $statement->fetchArray()) {
-                       if (!is_array($data['adapters'][$row['objectType']])) $data['adapters'][$row['objectType']] = array();
-                       $data['adapters'][$row['objectType']][] = $row;
-                       
-                       if (!is_array($data['objectTypes'][$row['objectType']])) $data['objectTypes'][$row['objectType']] = array();
-                       $data['objectTypes'][$row['objectType']][] = $row['packageID'];
-               }
-               
-               $data['objectTypes'] = array_unique($data['objectTypes']);
-               $data['packageIDs'] = array_unique($data['packageIDs']);
-               
-               return $data;
-       }
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderCoreObject.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderCoreObject.class.php
deleted file mode 100644 (file)
index ba48eac..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-namespace wcf\system\cache;
-use wcf\data\core\object\CoreObjectList;
-use wcf\system\package\PackageDependencyHandler;
-
-/**
- * Caches the core objects.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cache
- * @category   Community Framework
- */
-class CacheBuilderCoreObject implements CacheBuilder {
-       /**
-        * @see CacheBuilder::getData()
-        */
-       public function getData($cacheResource) {
-               list($cache, $packageID) = explode('-', $cacheResource['cache']);
-               $data = array();
-               
-               $coreObjectList = new CoreObjectList();
-               $coreObjectList->getConditionBuilder()->add("core_object.packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
-               $coreObjectList->sqlLimit = 0;
-               $coreObjectList->readObjects();
-               $coreObjects = $coreObjectList->getObjects();
-               
-               foreach ($coreObjects as $coreObject) {
-                       if (!isset($data[$coreObject->packageID])) {
-                               $data[$coreObject->packageID] = array();
-                       }
-                       
-                       $tmp = explode('\\', $coreObject->objectName);
-                       $className = array_pop($tmp);
-                       $data[$coreObject->packageID][$className] = $coreObject->objectName;
-               }
-               
-               return $data;
-       }
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderCronjob.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderCronjob.class.php
deleted file mode 100644 (file)
index c8634e5..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-namespace wcf\system\cache;
-use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\package\PackageDependencyHandler;
-use wcf\system\WCF;
-
-/**
- * Caches cronjob information.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cache
- * @category   Community Framework
- */
-class CacheBuilderCronjob implements CacheBuilder {
-       /**
-        * @see CacheBuilder::getData()
-        */
-       public function getData($cacheResource) {
-               // get next execution time
-               $conditionBuilder = new PreparedStatementConditionBuilder();
-               $conditionBuilder->add("packageID IN (?)", array(PackageDependencyHandler::getDependenciesString()));
-               
-               $sql = "SELECT          MIN(nextExec) AS nextExec,
-                                       MIN(afterNextExec) AS afterNextExec
-                       FROM            wcf".WCF_N."_cronjob
-                       ".$conditionBuilder->__toString();
-               $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute($conditionBuilder->getParameters());
-               $row = $statement->fetchArray();
-               
-               return array(
-                       'afterNextExec' => $row['afterNextExec'],
-                       'nextExec' => $row['nextExec']
-               );
-       }
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderEventListener.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderEventListener.class.php
deleted file mode 100644 (file)
index 1afbbbe..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php\r
-namespace wcf\system\cache;\r
-use wcf\system\event\listener\EventHandler;\r
-use wcf\system\WCF;\r
-use wcf\util\StringUtil;\r
-\r
-/**\r
- * Caches the event listeners.\r
- * \r
- * @author     Marcel Werk\r
- * @copyright  2001-2011 WoltLab GmbH\r
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
- * @package    com.woltlab.wcf\r
- * @subpackage system.cache\r
- * @category   Community Framework\r
- */\r
-class CacheBuilderEventListener implements CacheBuilder {\r
-       /**\r
-        * @see CacheBuilder::getData()\r
-        */\r
-       public function getData($cacheResource) {\r
-               list($cache, $packageID) = explode('-', $cacheResource['cache']); \r
-               $data = array(\r
-                       'actions' => array('user' => array(), 'admin' => array()),\r
-                       'inheritedActions' => array('user' => array(), 'admin' => array())\r
-               );\r
-               \r
-               // get all listeners and filter options with low priority\r
-               $sql = "SELECT          event_listener.*\r
-                       FROM            wcf".WCF_N."_event_listener event_listener\r
-                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
-                       ON              (package_dependency.dependency = event_listener.packageID)\r
-                       WHERE           package_dependency.packageID = ?\r
-                       ORDER BY        package_dependency.priority ASC";\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute(array($packageID));\r
-               while ($row = $statement->fetchArray()) {\r
-                       // distinguish between inherited actions and non-inherited actions\r
-                       if (!$row['inherit']) {\r
-                               $data['actions'][EventHandler::generateKey($row['eventClassName'], $row['eventName'])][] = $row;\r
-                       }\r
-                       else {\r
-                               if (!isset($data['inheritedActions'][$row['eventClassName']])) $data['inheritedActions'][$row['eventClassName']] = array();\r
-                               $data['inheritedActions'][$row['eventClassName']][$row['eventName']][] = $row;  \r
-                       }\r
-               }\r
-               \r
-               // sort data by nice value and class name\r
-               foreach ($data['actions'] as $key => $listeners) {\r
-                       uasort($data['actions'][$key], array(__CLASS__, 'sortListeners'));\r
-               }\r
-               \r
-               foreach ($data['inheritedActions'] as $class => $listeners) {\r
-                       foreach ($listeners as $key => $val) {\r
-                               uasort($data['inheritedActions'][$class][$key], array(__CLASS__, 'sortListeners'));\r
-                       }\r
-               }\r
-               \r
-               return $data;\r
-       }\r
-       \r
-       /**\r
-        * Sorts the event listeners alphabetically.\r
-        */\r
-       public static function sortListeners($listenerA, $listenerB) {\r
-               if ($listenerA['niceValue'] < $listenerB['niceValue']) {\r
-                       return -1;\r
-               }\r
-               else if ($listenerA['niceValue'] > $listenerB['niceValue']) {\r
-                       return 1;\r
-               }\r
-               else {\r
-                       return strcmp($listenerA['listenerClassName'], $listenerB['listenerClassName']);\r
-               }       \r
-       }\r
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderIcon.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderIcon.class.php
deleted file mode 100644 (file)
index 84e05ef..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-namespace wcf\system\cache;
-use wcf\data\package\Package;
-use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\package\PackageDependencyHandler;
-use wcf\system\WCF;
-use wcf\util\FileUtil;
-
-/**
- * Caches the paths of icons.
- * 
- * @author     Marcel Werk
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cache
- * @category   Community Framework
- */
-class CacheBuilderIcon implements CacheBuilder {
-       /**
-        * @see CacheBuilder::getData()
-        */
-       public function getData($cacheResource) {
-               list($cache, $packageID, $styleID) = explode('-', $cacheResource['cache']); 
-               $data = array();
-
-               // get active package
-               $activePackage = new Package($packageID);
-               $activePackageDir = FileUtil::getRealPath(WCF_DIR.$activePackage->getDir());
-               
-               // get package dirs
-               $packageDirs = array();
-               $conditionBuilder = new PreparedStatementConditionBuilder();
-               $conditionBuilder->add("packageID IN (?) AND packageDir <> ''", array(PackageDependencyHandler::getDependenciesString()));
-               $sql = "SELECT          DISTINCT packageDir
-                       FROM            wcf".WCF_N."_package package
-                       ".$conditionBuilder->__toString()."
-                       ORDER BY        priority DESC";
-               $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute($conditionBuilder->getParameters());
-               while ($row = $statement->fetchArray()) {
-                       $packageDirs[] = FileUtil::getRealPath(WCF_DIR.$row['packageDir']);
-               }
-               $packageDirs[] = WCF_DIR;
-               
-               // get style icon path
-               $iconDirs = array();
-               $sql = "SELECT  variableValue
-                       FROM    wcf".WCF_N."_style_variable
-                       WHERE   styleID = ?
-                               AND variableName = ?";
-               $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute(array($styleID, 'global.icons.location'));
-               $row = $statement->fetchArray();
-               if (!empty($row['variableValue'])) $iconDirs[] = FileUtil::addTrailingSlash($row['variableValue']);
-               if (!in_array('icon/', $iconDirs)) $iconDirs[] = 'icon/';
-               
-               // get icons
-               foreach ($packageDirs as $packageDir) {
-                       $relativePackageDir = ($activePackageDir != $packageDir ? FileUtil::getRelativePath($activePackageDir, $packageDir) : '');
-                       
-                       foreach ($iconDirs as $iconDir) {
-                               $path = FileUtil::addTrailingSlash($packageDir.$iconDir);
-                               $icons = self::getIconFiles($path);
-                               foreach ($icons as $icon) {
-                                       $icon = str_replace($path, '', $icon);
-                                       if (!isset($data[$icon])) {
-                                               $data[$icon] = $relativePackageDir.$iconDir.$icon;
-                                       }
-                               }
-                       }
-               }
-               
-               return $data;
-       }
-       
-       protected static function getIconFiles($path) {
-               $files = array();
-               if (is_dir($path)) {
-                       $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
-                       foreach ($iterator as $file) {
-                               if (preg_match('/\.png$/', $file->getFilename())) {
-                                       $files[] = $file->getPathname();
-                               }
-                       }
-               }
-               
-               return $files;
-       }
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderLanguage.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderLanguage.class.php
deleted file mode 100644 (file)
index 1e026e1..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php\r
-namespace wcf\system\cache;\r
-use wcf\system\WCF;\r
-\r
-/**\r
- * Caches languages, language to packages relation, package to languages relation\r
- * and the id of the default language. \r
- * \r
- * @author     Marcel Werk\r
- * @copyright  2001-2011 WoltLab GmbH\r
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
- * @package    com.woltlab.wcf\r
- * @subpackage system.cache\r
- * @category   Community Framework\r
- */\r
-class CacheBuilderLanguage implements CacheBuilder {\r
-       /**\r
-        * @see CacheBuilder::getData()\r
-        */\r
-       public function getData($cacheResource) {\r
-               $languageToPackages = array();\r
-               $data = array(\r
-                       'codes' => array(),\r
-                       'languages' => array(), \r
-                       'packages' => array(),\r
-                       'default' => 0,\r
-                       'categories' => array()\r
-               );\r
-               \r
-               // get language to packages\r
-               $sql = "SELECT          package.languageID, package.packageID\r
-                       FROM            wcf".WCF_N."_language_to_package package\r
-                       LEFT JOIN       wcf".WCF_N."_language language\r
-                       ON              (language.languageID = package.languageID)\r
-                       ORDER BY        language.isDefault DESC,\r
-                                       language.languageCode ASC";\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute();\r
-               while ($row = $statement->fetchArray()) {\r
-                       // package to languages\r
-                       if (!isset($data['packages'][$row['packageID']])) {\r
-                               $data['packages'][$row['packageID']] = array();\r
-                       }\r
-                       $data['packages'][$row['packageID']][] = $row['languageID'];\r
-                       \r
-                       // language to packages\r
-                       if (!isset($languageToPackages[$row['languageID']])) {\r
-                               $languageToPackages[$row['languageID']] = array();\r
-                       }\r
-                       $languageToPackages[$row['languageID']][] = $row['packageID'];\r
-               }\r
-               \r
-               // get languages\r
-               $sql = "SELECT  *\r
-                       FROM    wcf".WCF_N."_language";\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute();\r
-               while ($row = $statement->fetchArray()) {\r
-                       // language data\r
-                       $data['languages'][$row['languageID']] = $row;\r
-                       \r
-                       // language to packages\r
-                       if (!isset($languageToPackages[$row['languageID']])) {\r
-                               $languageToPackages[$row['languageID']] = array();\r
-                       }\r
-                       $data['languages'][$row['languageID']]['packages'] = $languageToPackages[$row['languageID']];\r
-                       \r
-                       // default language\r
-                       if ($row['isDefault']) {\r
-                               $data['default'] = $row['languageID'];\r
-                       }\r
-                       \r
-                       // language code to language id\r
-                       $data['codes'][$row['languageCode']] = $row['languageID'];\r
-               }\r
-               \r
-               // get language categories\r
-               $sql = "SELECT  *\r
-                       FROM    wcf".WCF_N."_language_category";\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute();\r
-               while ($row = $statement->fetchArray()) {\r
-                       // package to languages\r
-                       $data['categories'][$row['languageCategory']] = $row;\r
-               }\r
-\r
-               return $data;\r
-       }\r
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderOption.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderOption.class.php
deleted file mode 100644 (file)
index ef31b6f..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php\r
-namespace wcf\system\cache;\r
-use wcf\data\option\category\OptionCategory;\r
-use wcf\data\option\Option;\r
-use wcf\system\database\util\PreparedStatementConditionBuilder;\r
-use wcf\system\WCF;\r
-\r
-/**\r
- * Caches the options and option categories\r
- * \r
- * @author     Marcel Werk\r
- * @copyright  2001-2011 WoltLab GmbH\r
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
- * @package    com.woltlab.wcf\r
- * @subpackage system.cache\r
- * @category   Community Framework\r
- */\r
-class CacheBuilderOption implements CacheBuilder {\r
-       /**\r
-        * @see CacheBuilder::getData()\r
-        */\r
-       public function getData($cacheResource) {\r
-               $information = explode('-', $cacheResource['cache']);\r
-               if (count($information) == 3) {\r
-                       $type = $information[0].'_';\r
-                       $packageID = $information[2];\r
-               }\r
-               else {\r
-                       $type = '';\r
-                       $packageID = $information[1];\r
-               }\r
-                \r
-               $data = array(\r
-                       'categories' => array(),\r
-                       'options' => array(),\r
-                       'categoryStructure' => array(),\r
-                       'optionToCategories' => array()\r
-               );\r
-\r
-               // option categories\r
-               // get all option categories and sort categories by priority\r
-               $sql = "SELECT          categoryName, categoryID \r
-                       FROM            wcf".WCF_N."_".$type."option_category option_category\r
-                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
-                       ON              (package_dependency.dependency = option_category.packageID)\r
-                       WHERE           package_dependency.packageID = ?\r
-                       ORDER BY        package_dependency.priority ASC";\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute(array($packageID));\r
-               $optionCategories = array();\r
-               while ($row = $statement->fetchArray()) {\r
-                       $optionCategories[$row['categoryName']] = $row['categoryID'];\r
-               }\r
-               \r
-               if (count($optionCategories) > 0) {\r
-                       // get needed option categories\r
-                       $conditions = new PreparedStatementConditionBuilder();\r
-                       $conditions->add("categoryID IN (?)", array($optionCategories));\r
-                       \r
-                       $sql = "SELECT          option_category.*, package.packageDir\r
-                               FROM            wcf".WCF_N."_".$type."option_category option_category\r
-                               LEFT JOIN       wcf".WCF_N."_package package\r
-                               ON              (package.packageID = option_category.packageID)\r
-                               ".$conditions."\r
-                               ORDER BY        showOrder ASC";\r
-                       $statement = WCF::getDB()->prepareStatement($sql);\r
-                       $statement->execute($conditions->getParameters());\r
-                       while ($row = $statement->fetchArray()) {\r
-                               $data['categories'][$row['categoryName']] = new OptionCategory(null, $row);\r
-                               if (!isset($data['categoryStructure'][$row['parentCategoryName']])) {\r
-                                       $data['categoryStructure'][$row['parentCategoryName']] = array();\r
-                               }\r
-                               \r
-                               $data['categoryStructure'][$row['parentCategoryName']][] = $row['categoryName'];\r
-                       }\r
-               }\r
-               \r
-               // options\r
-               // get all options and sort options by priority\r
-               $optionIDs = array();\r
-               $sql = "SELECT          optionName, optionID \r
-                       FROM            wcf".WCF_N."_".$type."option option_table\r
-                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
-                       ON              (package_dependency.dependency = option_table.packageID)\r
-                       WHERE           package_dependency.packageID = ?\r
-                       ORDER BY        package_dependency.priority ASC";\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute(array($packageID));\r
-               while ($row = $statement->fetchArray()) {\r
-                       $optionIDs[$row['optionName']] = $row['optionID'];\r
-               }\r
-               \r
-               if (count($optionIDs) > 0) {\r
-                       // get needed options\r
-                       $conditions = new PreparedStatementConditionBuilder();\r
-                       $conditions->add("optionID IN (?)", array($optionIDs));\r
-                       \r
-                       $sql = "SELECT          *\r
-                               FROM            wcf".WCF_N."_".$type."option\r
-                               ".$conditions."\r
-                               ORDER BY        showOrder ASC";\r
-                       $statement = WCF::getDB()->prepareStatement($sql);\r
-                       $statement->execute($conditions->getParameters());\r
-                       while ($row = $statement->fetchArray()) {\r
-                               $data['options'][$row['optionName']] = new Option(null, $row);\r
-                               if (!isset($data['optionToCategories'][$row['categoryName']])) {\r
-                                       $data['optionToCategories'][$row['categoryName']] = array();\r
-                               }\r
-                               \r
-                               $data['optionToCategories'][$row['categoryName']][] = $row['optionName'];\r
-                       }\r
-               }\r
-               \r
-               return $data;\r
-       }\r
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderPackage.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderPackage.class.php
deleted file mode 100644 (file)
index 09ab660..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php\r
-namespace wcf\system\cache;\r
-use wcf\data\package\PackageList;\r
-use wcf\system\WCF;\r
-\r
-/**\r
- * Caches all registered packages.\r
- * \r
- * @author     Marcel Werk\r
- * @copyright  2001-2011 WoltLab GmbH\r
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
- * @package    com.woltlab.wcf\r
- * @subpackage system.cache\r
- * @category   Community Framework\r
- */\r
-class CacheBuilderPackage implements CacheBuilder {\r
-       /**\r
-        * @see CacheBuilder::getData()\r
-        */\r
-       public function getData($cacheResource) {\r
-               $packageList = new PackageList();\r
-               $packageList->sqlLimit = 0;\r
-               $packageList->readObjects();\r
-               \r
-               return $packageList->getObjects();\r
-       }\r
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderPackageDependency.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderPackageDependency.class.php
deleted file mode 100644 (file)
index 49d5c11..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-namespace wcf\system\cache;
-use wcf\system\WCF;
-
-/**
- * Caches the dependencies of a package.
- * 
- * @author     Marcel Werk
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cache
- * @category   Community Framework
- */
-class CacheBuilderPackageDependency implements CacheBuilder {
-       /**
-        * @see CacheBuilder::getData()
-        */
-       public function getData($cacheResource) {
-               list($cache, $packageID) = explode('-', $cacheResource['cache']);
-               $data = array(
-                       'dependency' => array(),
-                       'resolve' => array()
-               );
-               
-               if ($packageID != 0) {
-                       // general dependencies for current package id
-                       $sql = "SELECT  dependency
-                               FROM    wcf".WCF_N."_package_dependency
-                               WHERE   packageID = ?";
-                       $statement = WCF::getDB()->prepareStatement($sql);
-                       $statement->execute(array($packageID));
-                       while ($row = $statement->fetchArray()) {
-                               $data['dependency'][] = $row['dependency'];
-                       }
-                       
-                       // resolve package id by package name
-                       $sql = "SELECT          package.packageID, package.package
-                               FROM            wcf".WCF_N."_package_dependency package_dependency
-                               LEFT JOIN       wcf".WCF_N."_package package
-                               ON              (package.packageID = package_dependency.dependency)
-                               WHERE           package_dependency.packageID = ?
-                               ORDER BY        package_dependency.priority ASC";
-                       $statement = WCF::getDB()->prepareStatement($sql);
-                       $statement->execute(array($packageID));
-                       while ($row = $statement->fetchArray()) {
-                               if (!isset($data['resolve'][$row['package']])) $data['resolve'][$row['package']] = array();
-                               $data['resolve'][$row['package']][] = $row['packageID'];
-                       }
-                       
-                       foreach ($data['resolve'] as $package => $packageIDArray) {
-                               if (count($packageIDArray) == 1) {
-                                       $data[$package] = array_shift($packageIDArray);
-                               }
-                       }
-               }
-               
-               return $data;
-       }
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderPageMenu.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderPageMenu.class.php
deleted file mode 100644 (file)
index 44e41f3..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-namespace wcf\system\cache;
-use wcf\data\page\menu\item\PageMenuItem;
-use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\WCF;
-
-/**
- * Caches the page menu items.
- * 
- * @author     Marcel Werk
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cache
- * @category   Community Framework
- */
-class CacheBuilderPageMenu implements CacheBuilder {
-       /**
-        * @see CacheBuilder::getData()
-        */
-       public function getData($cacheResource) {
-               list($cache, $packageID) = explode('-', $cacheResource['cache']); 
-               $data = array();
-
-               // get all menu items and filter menu items with low priority
-               $sql = "SELECT          menuItem, menuItemID 
-                       FROM            wcf".WCF_N."_page_menu_item menu_item
-                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency
-                       ON              (package_dependency.dependency = menu_item.packageID)
-                       WHERE           package_dependency.packageID = ?
-                       ORDER BY        package_dependency.priority ASC";
-               $statement = WCF::getDB()->prepareStatement($sql);
-               $statement->execute(array($packageID));
-               $itemIDs = array();
-               while ($row = $statement->fetchArray()) {
-                       $itemIDs[$row['menuItem']] = $row['menuItemID'];
-               }
-               
-               if (count($itemIDs) > 0) {
-                       // get needed menu items and build item tree
-                       $conditions = new PreparedStatementConditionBuilder();
-                       $conditions->add("menu_item.menuItemID IN (?)", array($itemIDs));
-                       $conditions->add("menu_item.isDisabled = ?", array(0));
-                       
-                       $sql = "SELECT          menuItemID, menuItem, parentMenuItem, menuItemLink,
-                                               permissions, options, packageDir, menuPosition, className,
-                                               CASE WHEN parentPackageID <> 0 THEN parentPackageID ELSE menu_item.packageID END AS packageID
-                               FROM            wcf".WCF_N."_page_menu_item menu_item
-                               LEFT JOIN       wcf".WCF_N."_package package
-                               ON              (package.packageID = menu_item.packageID)
-                               ".$conditions."
-                               ORDER BY        showOrder ASC";
-                       $statement = WCF::getDB()->prepareStatement($sql);
-                       $statement->execute($conditions->getParameters());
-                       while ($row = $statement->fetchArray()) {
-                               $data[($row['parentMenuItem'] ? $row['parentMenuItem'] : $row['menuPosition'])][] = new PageMenuItem(null, $row);
-                       }
-               }
-               
-               return $data;
-       }
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderSpider.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderSpider.class.php
deleted file mode 100644 (file)
index 9020279..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php\r
-namespace wcf\system\cache;\r
-use wcf\data\spider\SpiderList;\r
-\r
-/**\r
- * Caches the list of search engine spiders.\r
- * \r
- * @author     Marcel Werk\r
- * @copyright  2001-2011 WoltLab GmbH\r
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
- * @package    com.woltlab.wcf\r
- * @subpackage system.cache\r
- * @category   Community Framework\r
- */\r
-class CacheBuilderSpider implements CacheBuilder {\r
-       /**\r
-        * @see CacheBuilder::getData()\r
-        */\r
-       public function getData($cacheResource) {\r
-               $spiderList = new SpiderList();\r
-               $spiderList->sqlOrderBy = "spider.spiderID ASC";\r
-               $spiderList->sqlLimit = 0;\r
-               $spiderList->readObjects();\r
-               \r
-               return $spiderList->getObjects();\r
-       }\r
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderStyle.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderStyle.class.php
deleted file mode 100644 (file)
index 91d81b1..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php\r
-namespace wcf\system\cache;\r
-use wcf\data\style\Style;\r
-use wcf\system\WCF;\r
-\r
-/**\r
- * Caches the styles and style variables.\r
- * \r
- * @author     Marcel Werk\r
- * @copyright  2001-2011 WoltLab GmbH\r
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
- * @package    com.woltlab.wcf\r
- * @subpackage system.cache\r
- * @category   Community Framework\r
- */\r
-class CacheBuilderStyle implements CacheBuilder {\r
-       /**\r
-        * @see CacheBuilder::getData()\r
-        */\r
-       public function getData($cacheResource) {\r
-               $data = array('default' => 0, 'styles' => array(), 'packages' => array());\r
-               \r
-               // get all styles\r
-               $sql = "SELECT          *\r
-                       FROM            wcf".WCF_N."_style\r
-                       ORDER BY        styleName ASC";\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute();\r
-               while ($row = $statement->fetchArray()) {\r
-                       if ($row['isDefault']) $data['default'] = $row['styleID'];\r
-                       $row['variables'] = array();\r
-                       \r
-                       // get variable\r
-                       $sql = "SELECT  *\r
-                               FROM    wcf".WCF_N."_style_variable\r
-                               WHERE   styleID = ?";\r
-                       $statement2 = WCF::getDB()->prepareStatement($sql);\r
-                       $statement2->execute(array($row['styleID']));\r
-                       while ($row = $statement2->fetchArray()) {\r
-                               \r
-                               $row['variables'][$row2['variableName']] = $row2['variableValue'];\r
-                       }\r
-                       \r
-                       $data['styles'][$row['styleID']] = new Style(null, $row);\r
-               }\r
-               \r
-               // get style to packages\r
-               $sql = "SELECT          *\r
-                       FROM            wcf".WCF_N."_style_to_package\r
-                       ORDER BY        packageID ASC";\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute();\r
-               while ($row = $statement->fetchArray()) {\r
-                       \r
-                       if (!isset($data['packages'][$row['packageID']])) {\r
-                               $data['packages'][$row['packageID']] = array('default' => 0, 'disabled' => array());\r
-                       }\r
-                       \r
-                       if ($row['isDefault']) {\r
-                               $data['packages'][$row['packageID']]['default'] = $row['styleID'];\r
-                       }\r
-                       $data['packages'][$row['packageID']]['disabled'][$row['styleID']] = $row['disabled'];\r
-               }\r
-               \r
-               return $data;\r
-       }\r
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderTemplate.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderTemplate.class.php
deleted file mode 100644 (file)
index 8fda51e..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php\r
-namespace wcf\system\cache;\r
-use wcf\system\WCF;\r
-\r
-/**\r
- * Caches the structure of templates.\r
- * \r
- * @author     Marcel Werk\r
- * @copyright  2001-2011 WoltLab GmbH\r
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
- * @package    com.woltlab.wcf\r
- * @subpackage system.cache\r
- * @category   Community Framework\r
- */\r
-class CacheBuilderTemplate implements CacheBuilder {\r
-       /**\r
-        * @see CacheBuilder::getData()\r
-        */\r
-       public function getData($cacheResource) {\r
-               $information = explode('-', $cacheResource['cache']);\r
-               if (count($information) == 3) {\r
-                       $prefix = $information[0].'_';\r
-                       $packageID = $information[2];\r
-               }\r
-               else {\r
-                       $prefix = '';\r
-                       $packageID = $information[1];\r
-               }\r
-               \r
-               $data = array();\r
-               \r
-               // get package directory for given package id\r
-               $sql = "SELECT  packageDir\r
-                       FROM    wcf".WCF_N."_package\r
-                       WHERE   packageID = ?";\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute(array($packageID));\r
-               $row = $statement->fetchArray();\r
-               \r
-               // get all templates and filter options with low priority\r
-               $sql = "SELECT          templateName, template.packageID \r
-                       FROM            wcf".WCF_N."_".$prefix."template template\r
-                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
-                       ON              (package_dependency.dependency = template.packageID)\r
-                       WHERE           package_dependency.packageID = ?\r
-                       ORDER BY        package_dependency.priority DESC";\r
-               $statement = WCF::getDB()->prepareStatement($sql);\r
-               $statement->execute(array($packageID));\r
-               while ($row = $statement->fetchArray()) {\r
-                       if (!isset($data[$row['templateName']]) || $packageID == $row['packageID']) {\r
-                               $data[$row['templateName']] = $row['packageID'];\r
-                       }\r
-               }\r
-               \r
-               return $data;\r
-       }\r
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderTemplateGroup.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderTemplateGroup.class.php
deleted file mode 100644 (file)
index 2ee8470..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-namespace wcf\system\cache;
-use wcf\data\template\group\TemplateGroupList;
-
-/**
- * Caches template groups.
- * 
- * @author     Marcel Werk
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cache
- * @category   Community Framework
- */
-class CacheBuilderTemplateGroup implements CacheBuilder {
-       /**
-        * @see CacheBuilder::getData()
-        */
-       public function getData($cacheResource) {
-               $templateGroupList = new TemplateGroupList();
-               $templateGroupList->sqlLimit = 0;
-               $templateGroupList->readObjects();
-               
-               return $templateGroupList->getObjects();
-       }
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderTemplateListener.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderTemplateListener.class.php
deleted file mode 100644 (file)
index d37802b..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-namespace wcf\system\cache;
-use wcf\data\template\listener\TemplateListenerList;
-use wcf\system\package\PackageDependencyHandler;
-
-/**
- * Caches template listener information.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cache
- * @category   Community Framework
- */
-class CacheBuilderTemplateListener implements CacheBuilder {
-       /**
-        * @see CacheBuilder::getData()
-        */
-       public function getData($cacheResource) {
-               list($cache, $packageID, $environment) = explode('-', $cacheResource['cache']); 
-               
-               // get templates for current package id
-               $templateListenerList = new TemplateListenerList();
-               $templateListenerList->getConditionBuilder()->add("template_listener.environment = ?", array($environment));
-               // work-around during setup
-               if (PACKAGE_ID) $templateListenerList->getConditionBuilder()->add("template_listener.packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
-               $templateListenerList->sqlLimit = 0;
-               $templateListenerList->readObjects();
-               
-               $data = array();
-               foreach ($templateListenerList->getObjects() as $templateListener) {
-                       $data[$templateListener->templateName] = array();
-               }
-               
-               return $data;
-       }
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderTemplateListenerCode.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderTemplateListenerCode.class.php
deleted file mode 100644 (file)
index a01db1a..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-namespace wcf\system\cache;
-use wcf\data\template\listener\TemplateListenerList;
-use wcf\system\package\PackageDependencyHandler;
-
-/**
- * Caches template listener code.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2011 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.cache
- * @category   Community Framework
- */
-class CacheBuilderTemplateListenerCode implements CacheBuilder {
-       /**
-        * @see CacheBuilder::getData()
-        */
-       public function getData($cacheResource) {
-               list($packageID, $environment, $templateName) = explode('-', $cacheResource['cache']); 
-               
-               // get template codes for specified template
-               $templateListenerList = new TemplateListenerList();
-               $templateListenerList->getConditionBuilder()->add("template_listener.environment = ?", array($environment));
-               $templateListenerList->getConditionBuilder()->add("template_listener.templateName = ?", array($templateName));
-               $templateListenerList->getConditionBuilder()->add("template_listener.packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
-               $templateListenerList->sqlLimit = 0;
-               $templateListenerList->readObjects();
-               
-               $data = array();
-               foreach ($templateListenerList->getObjects() as $templateListener) {
-                       $data[$templateListener->eventName][] = $templateListener->templateCode;
-               }
-               
-               return $data;
-       }
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderUserGroup.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderUserGroup.class.php
deleted file mode 100644 (file)
index be28d79..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php\r
-namespace wcf\system\cache;\r
-use wcf\data\user\group\UserGroupList;\r
-\r
-/**\r
- * Caches all user groups.\r
- * \r
- * @author     Marcel Werk\r
- * @copyright  2001-2011 WoltLab GmbH\r
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
- * @package    com.woltlab.wcf\r
- * @subpackage system.cache\r
- * @category   Community Framework\r
- */\r
-class CacheBuilderUserGroup implements CacheBuilder {\r
-       /**\r
-        * @see CacheBuilder::getData()\r
-        */\r
-       public function getData($cacheResource) {\r
-               $data = array('types' => array(), 'groups' => array());\r
-\r
-               // get all user groups\r
-               $groupList = new UserGroupList();\r
-               $groupList->sqlOrderBy = "user_group.groupName";\r
-               $groupList->sqlLimit = 0;\r
-               $groupList->readObjects();\r
-               $groups = $groupList->getObjects();\r
-               \r
-               foreach ($groups as $group) {\r
-                       if (!isset($data['types'][$group->groupType])) {\r
-                               $data['types'][$group->groupType] = array();\r
-                       }\r
-                       \r
-                       $data['types'][$group->groupType][] = $group->groupID;\r
-                       $data['groups'][$group->groupID] = $group;\r
-               }\r
-               \r
-               return $data;\r
-       }\r
-}
diff --git a/wcfsetup/install/files/lib/system/cache/CacheBuilderUserGroupPermission.class.php b/wcfsetup/install/files/lib/system/cache/CacheBuilderUserGroupPermission.class.php
deleted file mode 100644 (file)
index 0b70423..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php\r
-namespace wcf\system\cache;\r
-use wcf\system\database\util\PreparedStatementConditionBuilder;\r
-use wcf\system\exception\SystemException;\r
-use wcf\system\WCF;\r
-use wcf\util\ClassUtil;\r
-\r
-/**\r
- * Caches the merged group options of a group combination.\r
- * \r
- * @author     Marcel Werk\r
- * @copyright  2001-2011 WoltLab GmbH\r
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
- * @package    com.woltlab.wcf\r
- * @subpackage system.cache\r
- * @category   Community Framework\r
- */\r
-class CacheBuilderUserGroupPermission implements CacheBuilder {\r
-       protected $typeObjects = array();\r
-       \r
-       /**\r
-        * @see CacheBuilder::getData()\r
-        */\r
-       public function getData($cacheResource) {\r
-               list($cache, $packageID, $groupIDs) = explode('-', $cacheResource['cache']);\r
-               $data = array();\r
-               \r
-               // get all options and filter options with low priority\r
-               if ($packageID == 0) {\r
-                       // during the installation of the package wcf\r
-                       $sql = "SELECT          optionName, optionID \r
-                               FROM            wcf".WCF_N."_user_group_option\r
-                               WHERE           packageID IS NULL";\r
-                       $statement = WCF::getDB()->prepareStatement($sql);\r
-                       $statement->execute();\r
-               }\r
-               else {\r
-                       $sql = "SELECT          optionName, optionID \r
-                               FROM            wcf".WCF_N."_user_group_option option_table\r
-                               LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
-                               ON              (package_dependency.dependency = option_table.packageID)\r
-                               WHERE           package_dependency.packageID = ?\r
-                               ORDER BY        package_dependency.priority ASC";\r
-                       $statement = WCF::getDB()->prepareStatement($sql);\r
-                       $statement->execute(array($packageID));\r
-               }\r
-               \r
-               $options = array();\r
-               while ($row = $statement->fetchArray()) {\r
-                       $options[$row['optionName']] = $row['optionID'];\r
-               }\r
-               \r
-               if (count($options) > 0) {\r
-                       // get needed options\r
-                       $conditions = new PreparedStatementConditionBuilder();\r
-                       $conditions->add("option_value.groupID IN (?)", array(explode(',', $groupIDs)));\r
-                       $conditions->add("option_value.optionID IN (?)", array($options));\r
-                       \r
-                       $sql = "SELECT          option_table.optionName, option_table.optionType, option_value.optionValue\r
-                               FROM            wcf".WCF_N."_user_group_option_value option_value\r
-                               LEFT JOIN       wcf".WCF_N."_user_group_option option_table\r
-                               ON              (option_table.optionID = option_value.optionID)\r
-                               ".$conditions;\r
-                       $statement = WCF::getDB()->prepareStatement($sql);\r
-                       $statement->execute($conditions->getParameters());\r
-                       while ($row = $statement->fetchArray()) {\r
-                               if (!isset($data[$row['optionName']])) {\r
-                                       $data[$row['optionName']] = array('type' => $row['optionType'], 'values' => array());\r
-                               }\r
-                               \r
-                               $data[$row['optionName']]['values'][] = $row['optionValue'];\r
-                       }\r
-                       \r
-                       // merge values\r
-                       foreach ($data as $optionName => $option) {\r
-                               if (count($option['values']) == 1) {\r
-                                       $result = $option['values'][0];\r
-                               }\r
-                               else {\r
-                                       $typeObj = $this->getTypeObject($option['type']);\r
-                                       $result = $typeObj->merge($option['values']);\r
-                               }\r
-                               \r
-                               // unset false values\r
-                               if ($result === false) {\r
-                                       unset($data[$optionName]);\r
-                               }\r
-                               else {\r
-                                       $data[$optionName] = $result;\r
-                               }\r
-                       }\r
-               }\r
-               \r
-               $data['groupIDs'] = $groupIDs;\r
-               return $data;\r
-       }\r
-       \r
-       /**\r
-        * Returns an object of the requested group option type.\r
-        * \r
-        * @param       string                  $type\r
-        * @return      GroupOptionType\r
-        */\r
-       protected function getTypeObject($type) {\r
-               if (!isset($this->typeObjects[$type])) {\r
-                       $className = 'wcf\system\option\group\GroupOptionType'.ucfirst($type);\r
-                       \r
-                       // validate class\r
-                       if (!class_exists($className)) {\r
-                               throw new SystemException("unable to find class '".$className."'", 11001);\r
-                       }\r
-                       if (!ClassUtil::isInstanceOf($className, 'wcf\system\option\group\GroupOptionType')) {\r
-                               throw new SystemException("'".$className."' should implement GroupOptionType");\r
-                       }\r
-                       \r
-                       // create instance\r
-                       $this->typeObjects[$type] = new $className();\r
-               }\r
-               \r
-               return $this->typeObjects[$type];\r
-       }\r
-}
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderACPMenu.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderACPMenu.class.php
new file mode 100644 (file)
index 0000000..fc504cf
--- /dev/null
@@ -0,0 +1,151 @@
+<?php\r
+namespace wcf\system\cache\builder;\r
+use wcf\data\acp\menu\item\ACPMenuItem;\r
+use wcf\system\database\util\PreparedStatementConditionBuilder;\r
+use wcf\system\WCF;\r
+\r
+/**\r
+ * Caches the acp menu items tree.\r
+ * \r
+ * @author     Marcel Werk\r
+ * @copyright  2001-2011 WoltLab GmbH\r
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
+ * @package    com.woltlab.wcf\r
+ * @subpackage system.cache\r
+ * @category   Community Framework\r
+ */\r
+class CacheBuilderACPMenu implements CacheBuilder {\r
+       protected $optionCategoryStructure = array();\r
+\r
+       /**\r
+        * @see CacheBuilder::getData()\r
+        */\r
+       public function getData($cacheResource) {\r
+               list($cache, $packageID) = explode('-', $cacheResource['cache']); \r
+               $data = array();\r
+\r
+               // get all menu items and filter menu items with low priority\r
+               $sql = "SELECT          menuItem, menuItemID\r
+                       FROM            wcf".WCF_N."_acp_menu_item menu_item\r
+                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
+                       ON              (menu_item.packageID = package_dependency.dependency)\r
+                       WHERE           package_dependency.packageID = ?\r
+                       ORDER BY        package_dependency.priority ASC";\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute(array($packageID));\r
+               $itemIDs = array();\r
+               while ($row = $statement->fetchArray()) {\r
+                       $itemIDs[$row['menuItem']] = $row['menuItemID'];\r
+               }\r
+               \r
+               if (count($itemIDs) > 0) {\r
+                       $conditions = new PreparedStatementConditionBuilder();\r
+                       $conditions->add("menuItemID IN (?)", array($itemIDs));\r
+                       \r
+                       // get needed menu items and build item tree\r
+                       $sql = "SELECT          menu_item.packageID, menuItem, parentMenuItem,\r
+                                               menuItemLink, permissions, options, packageDir\r
+                               FROM            wcf".WCF_N."_acp_menu_item menu_item\r
+                               LEFT JOIN       wcf".WCF_N."_package package\r
+                               ON              (package.packageID = menu_item.packageID)\r
+                               ".$conditions."\r
+                               ORDER BY        showOrder ASC";\r
+                       $statement = WCF::getDB()->prepareStatement($sql);\r
+                       $statement->execute($conditions->getParameters());\r
+                       while ($row = $statement->fetchArray()) {\r
+                               if (!isset($data[$row['parentMenuItem']])) {\r
+                                       $data[$row['parentMenuItem']] = array();\r
+                               }\r
+                               \r
+                               $data[$row['parentMenuItem']][] = new ACPMenuItem(null, $row);\r
+                       }\r
+               }\r
+               \r
+               // get top option categories\r
+               $optionCategories = $this->getTopOptionCategories($packageID);\r
+               if (count($optionCategories) > 0) {\r
+                       if (!isset($data['wcf.acp.menu.link.option.category'])) {\r
+                               $data['wcf.acp.menu.link.option.category'] = array();\r
+                       }\r
+                       \r
+                       // get option category data\r
+                       $conditions = new PreparedStatementConditionBuilder();\r
+                       $conditions->add("categoryID IN (?)", array($optionCategories));\r
+                       \r
+                       $sql = "SELECT          *\r
+                               FROM            wcf".WCF_N."_option_category\r
+                               ".$conditions."\r
+                               ORDER BY        showOrder ASC";\r
+                       $statement = WCF::getDB()->prepareStatement($sql);\r
+                       $statement->execute($conditions->getParameters());\r
+                       while ($row = $statement->fetchArray()) {\r
+                               $data['wcf.acp.menu.link.option.category'][] = new ACPMenuItem(null, array(\r
+                                       'packageID' => $packageID,\r
+                                       'menuItem' => 'wcf.acp.option.category.'.$row['categoryName'],\r
+                                       'parentMenuItem' => 'wcf.acp.menu.link.option.category',\r
+                                       'menuItemLink' => 'index.php?form=Option&categoryID='.$row['categoryID'],\r
+                                       'packageDir' => '',\r
+                                       'permissions' => $row['permissions'],\r
+                                       'options' => $row['options']\r
+                               ));\r
+                       }\r
+               }\r
+               \r
+               return $data;\r
+       }\r
+       \r
+       protected function getTopOptionCategories($packageID) {\r
+               // get all option categories and filter categories with low priority\r
+               $sql = "SELECT          categoryName, categoryID \r
+                       FROM            wcf".WCF_N."_option_category option_category\r
+                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
+                       ON              (package_dependency.dependency = option_category.packageID)\r
+                       WHERE           package_dependency.packageID = ?\r
+                       ORDER BY        package_dependency.priority ASC";\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute(array($packageID));\r
+               $optionCategories = array();\r
+               while ($row = $statement->fetchArray()) {\r
+                       $optionCategories[$row['categoryName']] = $row['categoryID'];\r
+               }\r
+               \r
+               $conditions = new PreparedStatementConditionBuilder();\r
+               $conditions->add("categoryID IN (?)", array($optionCategories));\r
+               $statementParameters = $conditions->getParameters();\r
+               array_unshift($statementParameters, $packageID);\r
+               \r
+               $sql = "SELECT          categoryID, parentCategoryName, categoryName,\r
+                                       (\r
+                                               SELECT COUNT(*) FROM wcf".WCF_N."_option WHERE categoryName = category.categoryName AND packageID IN (\r
+                                                       SELECT dependency FROM wcf".WCF_N."_package_dependency WHERE packageID = ?\r
+                                               )\r
+                                       ) AS count\r
+                       FROM            wcf".WCF_N."_option_category category\r
+                       ".$conditions;\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute($statementParameters);\r
+               while ($row = $statement->fetchArray()) {\r
+                       if (!isset($this->optionCategoryStructure[$row['parentCategoryName']])) $this->optionCategoryStructure[$row['parentCategoryName']] = array();\r
+                       $this->optionCategoryStructure[$row['parentCategoryName']][] = $row;\r
+               }\r
+               \r
+               $topOptionCategories = array();\r
+               foreach ($this->optionCategoryStructure[''] as $optionCategory) {\r
+                       $count = $optionCategory['count'] + $this->countOptions($optionCategory['categoryName']);\r
+                       if ($count > 0) $topOptionCategories[] = $optionCategory['categoryID'];\r
+               }\r
+               \r
+               return $topOptionCategories;\r
+       }\r
+       \r
+       protected function countOptions($parentCategoryName) {\r
+               if (!isset($this->optionCategoryStructure[$parentCategoryName])) return 0;\r
+               \r
+               $count = 0;\r
+               foreach ($this->optionCategoryStructure[$parentCategoryName] as $optionCategory) {\r
+                       $count += $optionCategory['count'] + $this->countOptions($optionCategory['categoryName']);\r
+               }\r
+               \r
+               return $count;\r
+       }\r
+}\r
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderApplication.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderApplication.class.php
new file mode 100644 (file)
index 0000000..c9eca9f
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+namespace wcf\system\cache\builder;
+use wcf\data\application\group\ApplicationGroup;
+use wcf\data\application;
+use wcf\data\package\Package;
+use wcf\data\package\PackageList;
+use wcf\system\WCF;
+
+/**
+ * Caches applications.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache
+ * @category   Community Framework
+ */
+class CacheBuilderApplication implements CacheBuilder {
+       /**
+        * @see CacheBuilder::getData()
+        */
+       public function getData($cacheResource) {
+               list($cache, $packageID) = explode('-', $cacheResource['cache']);
+               $data = array(
+                       'abbreviation' => array(),
+                       'application' => array(),
+                       'group' => null,
+                       'primary' => 0,
+                       'wcf' => null
+               );
+               
+               // lookup group id for currently active application
+               $sql = "SELECT  groupID
+                       FROM    wcf".WCF_N."_application
+                       WHERE   packageID = ?";
+               $statement = WCF::getDB()->prepareStatement($sql);
+               $statement->execute(array($packageID));
+               $row = $statement->fetchArray();
+               
+               // current application is not part of an application group
+               if (!$row || ($row['groupID'] == 0) || $row['groupID'] === null) {
+                       $data['application'] = array($packageID => new application\Application($packageID));
+               }
+               else {
+                       // fetch applications
+                       $applicationList = new application\ApplicationList();
+                       $applicationList->getConditionBuilder()->add("application.groupID = ?", array($row['groupID']));
+                       $applicationList->sqlLimit = 0;
+                       $applicationList->readObjects();
+                       $applications = $applicationList->getObjects();
+                       
+                       foreach ($applications as $application) {
+                               $data['application'][$application->packageID] = $application;
+                               
+                               // save primary application's package id
+                               if ($application->isPrimary) {
+                                       $data['primary'] = $application->packageID;
+                               }
+                       }
+                       
+                       // fetch application group
+                       $data['group'] = new ApplicationGroup($row['groupID']);
+               }
+               
+               // fetch abbreviations
+               $packageList = new PackageList();
+               $packageList->getConditionBuilder()->add('packageID IN (?)', array(array_keys($data['application'])));
+               $packageList->readObjects();
+               foreach ($packageList->getObjects() as $package) {
+                       $data['abbreviation'][Package::getAbbreviation($package->package)] = $package->packageID;
+               }
+               
+               // fetch wcf pseudo-application
+               $data['wcf'] = new application\Application(1);
+               
+               return $data;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderCleanupAdapter.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderCleanupAdapter.class.php
new file mode 100644 (file)
index 0000000..2846cf6
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+namespace wcf\system\cache\builder;
+use wcf\system\WCF;
+
+/**
+ * Caches cleanup adapters.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache
+ * @category   Community Framework
+ */
+class CacheBuilderCleanupAdapter implements CacheBuilder {
+       /**
+        * @see CacheBuilder::getData()
+        */
+       public function getData($cacheResource) {
+               list($cache, $packageID) = explode('-', $cacheResource['cache']);
+               $data = array(
+                       'adapters' => array(),
+                       'objectTypes' => array(),
+                       'packageIDs' => array()
+               );
+               
+               $sql = "SELECT          listener.*, package.packageDir
+                       FROM            wcf".WCF_N."_cleanup_listener listener
+                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency
+                       ON              (package_dependency.dependency = listener.packageID)
+                       LEFT JOIN       wcf".WCF_N."_package package
+                       ON              (package.packageID = listener.packageID)
+                       WHERE           package_dependency.packageID = ?
+                       ORDER BY        package_dependency.priority ASC";
+               $statement = WCF::getDB()->prepareStatement($sql);
+               $statement->execute(array($packageID));
+               while ($row = $statement->fetchArray()) {
+                       if (!is_array($data['adapters'][$row['objectType']])) $data['adapters'][$row['objectType']] = array();
+                       $data['adapters'][$row['objectType']][] = $row;
+                       
+                       if (!is_array($data['objectTypes'][$row['objectType']])) $data['objectTypes'][$row['objectType']] = array();
+                       $data['objectTypes'][$row['objectType']][] = $row['packageID'];
+               }
+               
+               $data['objectTypes'] = array_unique($data['objectTypes']);
+               $data['packageIDs'] = array_unique($data['packageIDs']);
+               
+               return $data;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderCoreObject.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderCoreObject.class.php
new file mode 100644 (file)
index 0000000..33abc69
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+namespace wcf\system\cache\builder;
+use wcf\data\core\object\CoreObjectList;
+use wcf\system\package\PackageDependencyHandler;
+
+/**
+ * Caches the core objects.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache
+ * @category   Community Framework
+ */
+class CacheBuilderCoreObject implements CacheBuilder {
+       /**
+        * @see CacheBuilder::getData()
+        */
+       public function getData($cacheResource) {
+               list($cache, $packageID) = explode('-', $cacheResource['cache']);
+               $data = array();
+               
+               $coreObjectList = new CoreObjectList();
+               $coreObjectList->getConditionBuilder()->add("core_object.packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+               $coreObjectList->sqlLimit = 0;
+               $coreObjectList->readObjects();
+               $coreObjects = $coreObjectList->getObjects();
+               
+               foreach ($coreObjects as $coreObject) {
+                       if (!isset($data[$coreObject->packageID])) {
+                               $data[$coreObject->packageID] = array();
+                       }
+                       
+                       $tmp = explode('\\', $coreObject->objectName);
+                       $className = array_pop($tmp);
+                       $data[$coreObject->packageID][$className] = $coreObject->objectName;
+               }
+               
+               return $data;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderCronjob.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderCronjob.class.php
new file mode 100644 (file)
index 0000000..68f62bb
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+namespace wcf\system\cache\builder;
+use wcf\system\database\util\PreparedStatementConditionBuilder;
+use wcf\system\package\PackageDependencyHandler;
+use wcf\system\WCF;
+
+/**
+ * Caches cronjob information.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache
+ * @category   Community Framework
+ */
+class CacheBuilderCronjob implements CacheBuilder {
+       /**
+        * @see CacheBuilder::getData()
+        */
+       public function getData($cacheResource) {
+               // get next execution time
+               $conditionBuilder = new PreparedStatementConditionBuilder();
+               $conditionBuilder->add("packageID IN (?)", array(PackageDependencyHandler::getDependenciesString()));
+               
+               $sql = "SELECT          MIN(nextExec) AS nextExec,
+                                       MIN(afterNextExec) AS afterNextExec
+                       FROM            wcf".WCF_N."_cronjob
+                       ".$conditionBuilder->__toString();
+               $statement = WCF::getDB()->prepareStatement($sql);
+               $statement->execute($conditionBuilder->getParameters());
+               $row = $statement->fetchArray();
+               
+               return array(
+                       'afterNextExec' => $row['afterNextExec'],
+                       'nextExec' => $row['nextExec']
+               );
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderEventListener.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderEventListener.class.php
new file mode 100644 (file)
index 0000000..47ca8fe
--- /dev/null
@@ -0,0 +1,76 @@
+<?php\r
+namespace wcf\system\cache\builder;\r
+use wcf\system\event\listener\EventHandler;\r
+use wcf\system\WCF;\r
+use wcf\util\StringUtil;\r
+\r
+/**\r
+ * Caches the event listeners.\r
+ * \r
+ * @author     Marcel Werk\r
+ * @copyright  2001-2011 WoltLab GmbH\r
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
+ * @package    com.woltlab.wcf\r
+ * @subpackage system.cache\r
+ * @category   Community Framework\r
+ */\r
+class CacheBuilderEventListener implements CacheBuilder {\r
+       /**\r
+        * @see CacheBuilder::getData()\r
+        */\r
+       public function getData($cacheResource) {\r
+               list($cache, $packageID) = explode('-', $cacheResource['cache']); \r
+               $data = array(\r
+                       'actions' => array('user' => array(), 'admin' => array()),\r
+                       'inheritedActions' => array('user' => array(), 'admin' => array())\r
+               );\r
+               \r
+               // get all listeners and filter options with low priority\r
+               $sql = "SELECT          event_listener.*\r
+                       FROM            wcf".WCF_N."_event_listener event_listener\r
+                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
+                       ON              (package_dependency.dependency = event_listener.packageID)\r
+                       WHERE           package_dependency.packageID = ?\r
+                       ORDER BY        package_dependency.priority ASC";\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute(array($packageID));\r
+               while ($row = $statement->fetchArray()) {\r
+                       // distinguish between inherited actions and non-inherited actions\r
+                       if (!$row['inherit']) {\r
+                               $data['actions'][EventHandler::generateKey($row['eventClassName'], $row['eventName'])][] = $row;\r
+                       }\r
+                       else {\r
+                               if (!isset($data['inheritedActions'][$row['eventClassName']])) $data['inheritedActions'][$row['eventClassName']] = array();\r
+                               $data['inheritedActions'][$row['eventClassName']][$row['eventName']][] = $row;  \r
+                       }\r
+               }\r
+               \r
+               // sort data by nice value and class name\r
+               foreach ($data['actions'] as $key => $listeners) {\r
+                       uasort($data['actions'][$key], array(__CLASS__, 'sortListeners'));\r
+               }\r
+               \r
+               foreach ($data['inheritedActions'] as $class => $listeners) {\r
+                       foreach ($listeners as $key => $val) {\r
+                               uasort($data['inheritedActions'][$class][$key], array(__CLASS__, 'sortListeners'));\r
+                       }\r
+               }\r
+               \r
+               return $data;\r
+       }\r
+       \r
+       /**\r
+        * Sorts the event listeners alphabetically.\r
+        */\r
+       public static function sortListeners($listenerA, $listenerB) {\r
+               if ($listenerA['niceValue'] < $listenerB['niceValue']) {\r
+                       return -1;\r
+               }\r
+               else if ($listenerA['niceValue'] > $listenerB['niceValue']) {\r
+                       return 1;\r
+               }\r
+               else {\r
+                       return strcmp($listenerA['listenerClassName'], $listenerB['listenerClassName']);\r
+               }       \r
+       }\r
+}\r
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderIcon.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderIcon.class.php
new file mode 100644 (file)
index 0000000..4c93eaf
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+namespace wcf\system\cache\builder;
+use wcf\data\package\Package;
+use wcf\system\database\util\PreparedStatementConditionBuilder;
+use wcf\system\package\PackageDependencyHandler;
+use wcf\system\WCF;
+use wcf\util\FileUtil;
+
+/**
+ * Caches the paths of icons.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache
+ * @category   Community Framework
+ */
+class CacheBuilderIcon implements CacheBuilder {
+       /**
+        * @see CacheBuilder::getData()
+        */
+       public function getData($cacheResource) {
+               list($cache, $packageID, $styleID) = explode('-', $cacheResource['cache']); 
+               $data = array();
+
+               // get active package
+               $activePackage = new Package($packageID);
+               $activePackageDir = FileUtil::getRealPath(WCF_DIR.$activePackage->getDir());
+               
+               // get package dirs
+               $packageDirs = array();
+               $conditionBuilder = new PreparedStatementConditionBuilder();
+               $conditionBuilder->add("packageID IN (?) AND packageDir <> ''", array(PackageDependencyHandler::getDependenciesString()));
+               $sql = "SELECT          DISTINCT packageDir
+                       FROM            wcf".WCF_N."_package package
+                       ".$conditionBuilder->__toString()."
+                       ORDER BY        priority DESC";
+               $statement = WCF::getDB()->prepareStatement($sql);
+               $statement->execute($conditionBuilder->getParameters());
+               while ($row = $statement->fetchArray()) {
+                       $packageDirs[] = FileUtil::getRealPath(WCF_DIR.$row['packageDir']);
+               }
+               $packageDirs[] = WCF_DIR;
+               
+               // get style icon path
+               $iconDirs = array();
+               $sql = "SELECT  variableValue
+                       FROM    wcf".WCF_N."_style_variable
+                       WHERE   styleID = ?
+                               AND variableName = ?";
+               $statement = WCF::getDB()->prepareStatement($sql);
+               $statement->execute(array($styleID, 'global.icons.location'));
+               $row = $statement->fetchArray();
+               if (!empty($row['variableValue'])) $iconDirs[] = FileUtil::addTrailingSlash($row['variableValue']);
+               if (!in_array('icon/', $iconDirs)) $iconDirs[] = 'icon/';
+               
+               // get icons
+               foreach ($packageDirs as $packageDir) {
+                       $relativePackageDir = ($activePackageDir != $packageDir ? FileUtil::getRelativePath($activePackageDir, $packageDir) : '');
+                       
+                       foreach ($iconDirs as $iconDir) {
+                               $path = FileUtil::addTrailingSlash($packageDir.$iconDir);
+                               $icons = self::getIconFiles($path);
+                               foreach ($icons as $icon) {
+                                       $icon = str_replace($path, '', $icon);
+                                       if (!isset($data[$icon])) {
+                                               $data[$icon] = $relativePackageDir.$iconDir.$icon;
+                                       }
+                               }
+                       }
+               }
+               
+               return $data;
+       }
+       
+       protected static function getIconFiles($path) {
+               $files = array();
+               if (is_dir($path)) {
+                       $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
+                       foreach ($iterator as $file) {
+                               if (preg_match('/\.png$/', $file->getFilename())) {
+                                       $files[] = $file->getPathname();
+                               }
+                       }
+               }
+               
+               return $files;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderLanguage.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderLanguage.class.php
new file mode 100644 (file)
index 0000000..844ce46
--- /dev/null
@@ -0,0 +1,89 @@
+<?php\r
+namespace wcf\system\cache\builder;\r
+use wcf\system\WCF;\r
+\r
+/**\r
+ * Caches languages, language to packages relation, package to languages relation\r
+ * and the id of the default language. \r
+ * \r
+ * @author     Marcel Werk\r
+ * @copyright  2001-2011 WoltLab GmbH\r
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
+ * @package    com.woltlab.wcf\r
+ * @subpackage system.cache\r
+ * @category   Community Framework\r
+ */\r
+class CacheBuilderLanguage implements CacheBuilder {\r
+       /**\r
+        * @see CacheBuilder::getData()\r
+        */\r
+       public function getData($cacheResource) {\r
+               $languageToPackages = array();\r
+               $data = array(\r
+                       'codes' => array(),\r
+                       'languages' => array(), \r
+                       'packages' => array(),\r
+                       'default' => 0,\r
+                       'categories' => array()\r
+               );\r
+               \r
+               // get language to packages\r
+               $sql = "SELECT          package.languageID, package.packageID\r
+                       FROM            wcf".WCF_N."_language_to_package package\r
+                       LEFT JOIN       wcf".WCF_N."_language language\r
+                       ON              (language.languageID = package.languageID)\r
+                       ORDER BY        language.isDefault DESC,\r
+                                       language.languageCode ASC";\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute();\r
+               while ($row = $statement->fetchArray()) {\r
+                       // package to languages\r
+                       if (!isset($data['packages'][$row['packageID']])) {\r
+                               $data['packages'][$row['packageID']] = array();\r
+                       }\r
+                       $data['packages'][$row['packageID']][] = $row['languageID'];\r
+                       \r
+                       // language to packages\r
+                       if (!isset($languageToPackages[$row['languageID']])) {\r
+                               $languageToPackages[$row['languageID']] = array();\r
+                       }\r
+                       $languageToPackages[$row['languageID']][] = $row['packageID'];\r
+               }\r
+               \r
+               // get languages\r
+               $sql = "SELECT  *\r
+                       FROM    wcf".WCF_N."_language";\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute();\r
+               while ($row = $statement->fetchArray()) {\r
+                       // language data\r
+                       $data['languages'][$row['languageID']] = $row;\r
+                       \r
+                       // language to packages\r
+                       if (!isset($languageToPackages[$row['languageID']])) {\r
+                               $languageToPackages[$row['languageID']] = array();\r
+                       }\r
+                       $data['languages'][$row['languageID']]['packages'] = $languageToPackages[$row['languageID']];\r
+                       \r
+                       // default language\r
+                       if ($row['isDefault']) {\r
+                               $data['default'] = $row['languageID'];\r
+                       }\r
+                       \r
+                       // language code to language id\r
+                       $data['codes'][$row['languageCode']] = $row['languageID'];\r
+               }\r
+               \r
+               // get language categories\r
+               $sql = "SELECT  *\r
+                       FROM    wcf".WCF_N."_language_category";\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute();\r
+               while ($row = $statement->fetchArray()) {\r
+                       // package to languages\r
+                       $data['categories'][$row['languageCategory']] = $row;\r
+               }\r
+\r
+               return $data;\r
+       }\r
+}\r
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderOption.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderOption.class.php
new file mode 100644 (file)
index 0000000..8266060
--- /dev/null
@@ -0,0 +1,116 @@
+<?php\r
+namespace wcf\system\cache\builder;\r
+use wcf\data\option\category\OptionCategory;\r
+use wcf\data\option\Option;\r
+use wcf\system\database\util\PreparedStatementConditionBuilder;\r
+use wcf\system\WCF;\r
+\r
+/**\r
+ * Caches the options and option categories\r
+ * \r
+ * @author     Marcel Werk\r
+ * @copyright  2001-2011 WoltLab GmbH\r
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
+ * @package    com.woltlab.wcf\r
+ * @subpackage system.cache\r
+ * @category   Community Framework\r
+ */\r
+class CacheBuilderOption implements CacheBuilder {\r
+       /**\r
+        * @see CacheBuilder::getData()\r
+        */\r
+       public function getData($cacheResource) {\r
+               $information = explode('-', $cacheResource['cache']);\r
+               if (count($information) == 3) {\r
+                       $type = $information[0].'_';\r
+                       $packageID = $information[2];\r
+               }\r
+               else {\r
+                       $type = '';\r
+                       $packageID = $information[1];\r
+               }\r
+                \r
+               $data = array(\r
+                       'categories' => array(),\r
+                       'options' => array(),\r
+                       'categoryStructure' => array(),\r
+                       'optionToCategories' => array()\r
+               );\r
+\r
+               // option categories\r
+               // get all option categories and sort categories by priority\r
+               $sql = "SELECT          categoryName, categoryID \r
+                       FROM            wcf".WCF_N."_".$type."option_category option_category\r
+                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
+                       ON              (package_dependency.dependency = option_category.packageID)\r
+                       WHERE           package_dependency.packageID = ?\r
+                       ORDER BY        package_dependency.priority ASC";\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute(array($packageID));\r
+               $optionCategories = array();\r
+               while ($row = $statement->fetchArray()) {\r
+                       $optionCategories[$row['categoryName']] = $row['categoryID'];\r
+               }\r
+               \r
+               if (count($optionCategories) > 0) {\r
+                       // get needed option categories\r
+                       $conditions = new PreparedStatementConditionBuilder();\r
+                       $conditions->add("categoryID IN (?)", array($optionCategories));\r
+                       \r
+                       $sql = "SELECT          option_category.*, package.packageDir\r
+                               FROM            wcf".WCF_N."_".$type."option_category option_category\r
+                               LEFT JOIN       wcf".WCF_N."_package package\r
+                               ON              (package.packageID = option_category.packageID)\r
+                               ".$conditions."\r
+                               ORDER BY        showOrder ASC";\r
+                       $statement = WCF::getDB()->prepareStatement($sql);\r
+                       $statement->execute($conditions->getParameters());\r
+                       while ($row = $statement->fetchArray()) {\r
+                               $data['categories'][$row['categoryName']] = new OptionCategory(null, $row);\r
+                               if (!isset($data['categoryStructure'][$row['parentCategoryName']])) {\r
+                                       $data['categoryStructure'][$row['parentCategoryName']] = array();\r
+                               }\r
+                               \r
+                               $data['categoryStructure'][$row['parentCategoryName']][] = $row['categoryName'];\r
+                       }\r
+               }\r
+               \r
+               // options\r
+               // get all options and sort options by priority\r
+               $optionIDs = array();\r
+               $sql = "SELECT          optionName, optionID \r
+                       FROM            wcf".WCF_N."_".$type."option option_table\r
+                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
+                       ON              (package_dependency.dependency = option_table.packageID)\r
+                       WHERE           package_dependency.packageID = ?\r
+                       ORDER BY        package_dependency.priority ASC";\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute(array($packageID));\r
+               while ($row = $statement->fetchArray()) {\r
+                       $optionIDs[$row['optionName']] = $row['optionID'];\r
+               }\r
+               \r
+               if (count($optionIDs) > 0) {\r
+                       // get needed options\r
+                       $conditions = new PreparedStatementConditionBuilder();\r
+                       $conditions->add("optionID IN (?)", array($optionIDs));\r
+                       \r
+                       $sql = "SELECT          *\r
+                               FROM            wcf".WCF_N."_".$type."option\r
+                               ".$conditions."\r
+                               ORDER BY        showOrder ASC";\r
+                       $statement = WCF::getDB()->prepareStatement($sql);\r
+                       $statement->execute($conditions->getParameters());\r
+                       while ($row = $statement->fetchArray()) {\r
+                               $data['options'][$row['optionName']] = new Option(null, $row);\r
+                               if (!isset($data['optionToCategories'][$row['categoryName']])) {\r
+                                       $data['optionToCategories'][$row['categoryName']] = array();\r
+                               }\r
+                               \r
+                               $data['optionToCategories'][$row['categoryName']][] = $row['optionName'];\r
+                       }\r
+               }\r
+               \r
+               return $data;\r
+       }\r
+}\r
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderPackage.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderPackage.class.php
new file mode 100644 (file)
index 0000000..bd01e09
--- /dev/null
@@ -0,0 +1,27 @@
+<?php\r
+namespace wcf\system\cache\builder;\r
+use wcf\data\package\PackageList;\r
+use wcf\system\WCF;\r
+\r
+/**\r
+ * Caches all registered packages.\r
+ * \r
+ * @author     Marcel Werk\r
+ * @copyright  2001-2011 WoltLab GmbH\r
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
+ * @package    com.woltlab.wcf\r
+ * @subpackage system.cache\r
+ * @category   Community Framework\r
+ */\r
+class CacheBuilderPackage implements CacheBuilder {\r
+       /**\r
+        * @see CacheBuilder::getData()\r
+        */\r
+       public function getData($cacheResource) {\r
+               $packageList = new PackageList();\r
+               $packageList->sqlLimit = 0;\r
+               $packageList->readObjects();\r
+               \r
+               return $packageList->getObjects();\r
+       }\r
+}\r
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderPackageDependency.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderPackageDependency.class.php
new file mode 100644 (file)
index 0000000..254294f
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+namespace wcf\system\cache\builder;
+use wcf\system\WCF;
+
+/**
+ * Caches the dependencies of a package.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache
+ * @category   Community Framework
+ */
+class CacheBuilderPackageDependency implements CacheBuilder {
+       /**
+        * @see CacheBuilder::getData()
+        */
+       public function getData($cacheResource) {
+               list($cache, $packageID) = explode('-', $cacheResource['cache']);
+               $data = array(
+                       'dependency' => array(),
+                       'resolve' => array()
+               );
+               
+               if ($packageID != 0) {
+                       // general dependencies for current package id
+                       $sql = "SELECT  dependency
+                               FROM    wcf".WCF_N."_package_dependency
+                               WHERE   packageID = ?";
+                       $statement = WCF::getDB()->prepareStatement($sql);
+                       $statement->execute(array($packageID));
+                       while ($row = $statement->fetchArray()) {
+                               $data['dependency'][] = $row['dependency'];
+                       }
+                       
+                       // resolve package id by package name
+                       $sql = "SELECT          package.packageID, package.package
+                               FROM            wcf".WCF_N."_package_dependency package_dependency
+                               LEFT JOIN       wcf".WCF_N."_package package
+                               ON              (package.packageID = package_dependency.dependency)
+                               WHERE           package_dependency.packageID = ?
+                               ORDER BY        package_dependency.priority ASC";
+                       $statement = WCF::getDB()->prepareStatement($sql);
+                       $statement->execute(array($packageID));
+                       while ($row = $statement->fetchArray()) {
+                               if (!isset($data['resolve'][$row['package']])) $data['resolve'][$row['package']] = array();
+                               $data['resolve'][$row['package']][] = $row['packageID'];
+                       }
+                       
+                       foreach ($data['resolve'] as $package => $packageIDArray) {
+                               if (count($packageIDArray) == 1) {
+                                       $data[$package] = array_shift($packageIDArray);
+                               }
+                       }
+               }
+               
+               return $data;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderPageMenu.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderPageMenu.class.php
new file mode 100644 (file)
index 0000000..f968c29
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+namespace wcf\system\cache\builder;
+use wcf\data\page\menu\item\PageMenuItem;
+use wcf\system\database\util\PreparedStatementConditionBuilder;
+use wcf\system\WCF;
+
+/**
+ * Caches the page menu items.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache
+ * @category   Community Framework
+ */
+class CacheBuilderPageMenu implements CacheBuilder {
+       /**
+        * @see CacheBuilder::getData()
+        */
+       public function getData($cacheResource) {
+               list($cache, $packageID) = explode('-', $cacheResource['cache']); 
+               $data = array();
+
+               // get all menu items and filter menu items with low priority
+               $sql = "SELECT          menuItem, menuItemID 
+                       FROM            wcf".WCF_N."_page_menu_item menu_item
+                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency
+                       ON              (package_dependency.dependency = menu_item.packageID)
+                       WHERE           package_dependency.packageID = ?
+                       ORDER BY        package_dependency.priority ASC";
+               $statement = WCF::getDB()->prepareStatement($sql);
+               $statement->execute(array($packageID));
+               $itemIDs = array();
+               while ($row = $statement->fetchArray()) {
+                       $itemIDs[$row['menuItem']] = $row['menuItemID'];
+               }
+               
+               if (count($itemIDs) > 0) {
+                       // get needed menu items and build item tree
+                       $conditions = new PreparedStatementConditionBuilder();
+                       $conditions->add("menu_item.menuItemID IN (?)", array($itemIDs));
+                       $conditions->add("menu_item.isDisabled = ?", array(0));
+                       
+                       $sql = "SELECT          menuItemID, menuItem, parentMenuItem, menuItemLink,
+                                               permissions, options, packageDir, menuPosition, className,
+                                               CASE WHEN parentPackageID <> 0 THEN parentPackageID ELSE menu_item.packageID END AS packageID
+                               FROM            wcf".WCF_N."_page_menu_item menu_item
+                               LEFT JOIN       wcf".WCF_N."_package package
+                               ON              (package.packageID = menu_item.packageID)
+                               ".$conditions."
+                               ORDER BY        showOrder ASC";
+                       $statement = WCF::getDB()->prepareStatement($sql);
+                       $statement->execute($conditions->getParameters());
+                       while ($row = $statement->fetchArray()) {
+                               $data[($row['parentMenuItem'] ? $row['parentMenuItem'] : $row['menuPosition'])][] = new PageMenuItem(null, $row);
+                       }
+               }
+               
+               return $data;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderSpider.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderSpider.class.php
new file mode 100644 (file)
index 0000000..0e5aca1
--- /dev/null
@@ -0,0 +1,27 @@
+<?php\r
+namespace wcf\system\cache\builder;\r
+use wcf\data\spider\SpiderList;\r
+\r
+/**\r
+ * Caches the list of search engine spiders.\r
+ * \r
+ * @author     Marcel Werk\r
+ * @copyright  2001-2011 WoltLab GmbH\r
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
+ * @package    com.woltlab.wcf\r
+ * @subpackage system.cache\r
+ * @category   Community Framework\r
+ */\r
+class CacheBuilderSpider implements CacheBuilder {\r
+       /**\r
+        * @see CacheBuilder::getData()\r
+        */\r
+       public function getData($cacheResource) {\r
+               $spiderList = new SpiderList();\r
+               $spiderList->sqlOrderBy = "spider.spiderID ASC";\r
+               $spiderList->sqlLimit = 0;\r
+               $spiderList->readObjects();\r
+               \r
+               return $spiderList->getObjects();\r
+       }\r
+}\r
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderStyle.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderStyle.class.php
new file mode 100644 (file)
index 0000000..9654d61
--- /dev/null
@@ -0,0 +1,67 @@
+<?php\r
+namespace wcf\system\cache\builder;\r
+use wcf\data\style\Style;\r
+use wcf\system\WCF;\r
+\r
+/**\r
+ * Caches the styles and style variables.\r
+ * \r
+ * @author     Marcel Werk\r
+ * @copyright  2001-2011 WoltLab GmbH\r
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
+ * @package    com.woltlab.wcf\r
+ * @subpackage system.cache\r
+ * @category   Community Framework\r
+ */\r
+class CacheBuilderStyle implements CacheBuilder {\r
+       /**\r
+        * @see CacheBuilder::getData()\r
+        */\r
+       public function getData($cacheResource) {\r
+               $data = array('default' => 0, 'styles' => array(), 'packages' => array());\r
+               \r
+               // get all styles\r
+               $sql = "SELECT          *\r
+                       FROM            wcf".WCF_N."_style\r
+                       ORDER BY        styleName ASC";\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute();\r
+               while ($row = $statement->fetchArray()) {\r
+                       if ($row['isDefault']) $data['default'] = $row['styleID'];\r
+                       $row['variables'] = array();\r
+                       \r
+                       // get variable\r
+                       $sql = "SELECT  *\r
+                               FROM    wcf".WCF_N."_style_variable\r
+                               WHERE   styleID = ?";\r
+                       $statement2 = WCF::getDB()->prepareStatement($sql);\r
+                       $statement2->execute(array($row['styleID']));\r
+                       while ($row = $statement2->fetchArray()) {\r
+                               \r
+                               $row['variables'][$row2['variableName']] = $row2['variableValue'];\r
+                       }\r
+                       \r
+                       $data['styles'][$row['styleID']] = new Style(null, $row);\r
+               }\r
+               \r
+               // get style to packages\r
+               $sql = "SELECT          *\r
+                       FROM            wcf".WCF_N."_style_to_package\r
+                       ORDER BY        packageID ASC";\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute();\r
+               while ($row = $statement->fetchArray()) {\r
+                       \r
+                       if (!isset($data['packages'][$row['packageID']])) {\r
+                               $data['packages'][$row['packageID']] = array('default' => 0, 'disabled' => array());\r
+                       }\r
+                       \r
+                       if ($row['isDefault']) {\r
+                               $data['packages'][$row['packageID']]['default'] = $row['styleID'];\r
+                       }\r
+                       $data['packages'][$row['packageID']]['disabled'][$row['styleID']] = $row['disabled'];\r
+               }\r
+               \r
+               return $data;\r
+       }\r
+}\r
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplate.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplate.class.php
new file mode 100644 (file)
index 0000000..d03724d
--- /dev/null
@@ -0,0 +1,57 @@
+<?php\r
+namespace wcf\system\cache\builder;\r
+use wcf\system\WCF;\r
+\r
+/**\r
+ * Caches the structure of templates.\r
+ * \r
+ * @author     Marcel Werk\r
+ * @copyright  2001-2011 WoltLab GmbH\r
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
+ * @package    com.woltlab.wcf\r
+ * @subpackage system.cache\r
+ * @category   Community Framework\r
+ */\r
+class CacheBuilderTemplate implements CacheBuilder {\r
+       /**\r
+        * @see CacheBuilder::getData()\r
+        */\r
+       public function getData($cacheResource) {\r
+               $information = explode('-', $cacheResource['cache']);\r
+               if (count($information) == 3) {\r
+                       $prefix = $information[0].'_';\r
+                       $packageID = $information[2];\r
+               }\r
+               else {\r
+                       $prefix = '';\r
+                       $packageID = $information[1];\r
+               }\r
+               \r
+               $data = array();\r
+               \r
+               // get package directory for given package id\r
+               $sql = "SELECT  packageDir\r
+                       FROM    wcf".WCF_N."_package\r
+                       WHERE   packageID = ?";\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute(array($packageID));\r
+               $row = $statement->fetchArray();\r
+               \r
+               // get all templates and filter options with low priority\r
+               $sql = "SELECT          templateName, template.packageID \r
+                       FROM            wcf".WCF_N."_".$prefix."template template\r
+                       LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
+                       ON              (package_dependency.dependency = template.packageID)\r
+                       WHERE           package_dependency.packageID = ?\r
+                       ORDER BY        package_dependency.priority DESC";\r
+               $statement = WCF::getDB()->prepareStatement($sql);\r
+               $statement->execute(array($packageID));\r
+               while ($row = $statement->fetchArray()) {\r
+                       if (!isset($data[$row['templateName']]) || $packageID == $row['packageID']) {\r
+                               $data[$row['templateName']] = $row['packageID'];\r
+                       }\r
+               }\r
+               \r
+               return $data;\r
+       }\r
+}\r
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplateGroup.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplateGroup.class.php
new file mode 100644 (file)
index 0000000..dc69ce2
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+namespace wcf\system\cache\builder;
+use wcf\data\template\group\TemplateGroupList;
+
+/**
+ * Caches template groups.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache
+ * @category   Community Framework
+ */
+class CacheBuilderTemplateGroup implements CacheBuilder {
+       /**
+        * @see CacheBuilder::getData()
+        */
+       public function getData($cacheResource) {
+               $templateGroupList = new TemplateGroupList();
+               $templateGroupList->sqlLimit = 0;
+               $templateGroupList->readObjects();
+               
+               return $templateGroupList->getObjects();
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplateListener.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplateListener.class.php
new file mode 100644 (file)
index 0000000..b73a437
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+namespace wcf\system\cache\builder;
+use wcf\data\template\listener\TemplateListenerList;
+use wcf\system\package\PackageDependencyHandler;
+
+/**
+ * Caches template listener information.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache
+ * @category   Community Framework
+ */
+class CacheBuilderTemplateListener implements CacheBuilder {
+       /**
+        * @see CacheBuilder::getData()
+        */
+       public function getData($cacheResource) {
+               list($cache, $packageID, $environment) = explode('-', $cacheResource['cache']); 
+               
+               // get templates for current package id
+               $templateListenerList = new TemplateListenerList();
+               $templateListenerList->getConditionBuilder()->add("template_listener.environment = ?", array($environment));
+               // work-around during setup
+               if (PACKAGE_ID) $templateListenerList->getConditionBuilder()->add("template_listener.packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+               $templateListenerList->sqlLimit = 0;
+               $templateListenerList->readObjects();
+               
+               $data = array();
+               foreach ($templateListenerList->getObjects() as $templateListener) {
+                       $data[$templateListener->templateName] = array();
+               }
+               
+               return $data;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplateListenerCode.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplateListenerCode.class.php
new file mode 100644 (file)
index 0000000..40d3a14
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+namespace wcf\system\cache\builder;
+use wcf\data\template\listener\TemplateListenerList;
+use wcf\system\package\PackageDependencyHandler;
+
+/**
+ * Caches template listener code.
+ * 
+ * @author     Alexander Ebert
+ * @copyright  2001-2011 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.cache
+ * @category   Community Framework
+ */
+class CacheBuilderTemplateListenerCode implements CacheBuilder {
+       /**
+        * @see CacheBuilder::getData()
+        */
+       public function getData($cacheResource) {
+               list($packageID, $environment, $templateName) = explode('-', $cacheResource['cache']); 
+               
+               // get template codes for specified template
+               $templateListenerList = new TemplateListenerList();
+               $templateListenerList->getConditionBuilder()->add("template_listener.environment = ?", array($environment));
+               $templateListenerList->getConditionBuilder()->add("template_listener.templateName = ?", array($templateName));
+               $templateListenerList->getConditionBuilder()->add("template_listener.packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+               $templateListenerList->sqlLimit = 0;
+               $templateListenerList->readObjects();
+               
+               $data = array();
+               foreach ($templateListenerList->getObjects() as $templateListener) {
+                       $data[$templateListener->eventName][] = $templateListener->templateCode;
+               }
+               
+               return $data;
+       }
+}
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderUserGroup.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderUserGroup.class.php
new file mode 100644 (file)
index 0000000..d5316a4
--- /dev/null
@@ -0,0 +1,40 @@
+<?php\r
+namespace wcf\system\cache\builder;\r
+use wcf\data\user\group\UserGroupList;\r
+\r
+/**\r
+ * Caches all user groups.\r
+ * \r
+ * @author     Marcel Werk\r
+ * @copyright  2001-2011 WoltLab GmbH\r
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
+ * @package    com.woltlab.wcf\r
+ * @subpackage system.cache\r
+ * @category   Community Framework\r
+ */\r
+class CacheBuilderUserGroup implements CacheBuilder {\r
+       /**\r
+        * @see CacheBuilder::getData()\r
+        */\r
+       public function getData($cacheResource) {\r
+               $data = array('types' => array(), 'groups' => array());\r
+\r
+               // get all user groups\r
+               $groupList = new UserGroupList();\r
+               $groupList->sqlOrderBy = "user_group.groupName";\r
+               $groupList->sqlLimit = 0;\r
+               $groupList->readObjects();\r
+               $groups = $groupList->getObjects();\r
+               \r
+               foreach ($groups as $group) {\r
+                       if (!isset($data['types'][$group->groupType])) {\r
+                               $data['types'][$group->groupType] = array();\r
+                       }\r
+                       \r
+                       $data['types'][$group->groupType][] = $group->groupID;\r
+                       $data['groups'][$group->groupID] = $group;\r
+               }\r
+               \r
+               return $data;\r
+       }\r
+}\r
diff --git a/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderUserGroupPermission.class.php b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderUserGroupPermission.class.php
new file mode 100644 (file)
index 0000000..9e50abd
--- /dev/null
@@ -0,0 +1,122 @@
+<?php\r
+namespace wcf\system\cache\builder;\r
+use wcf\system\database\util\PreparedStatementConditionBuilder;\r
+use wcf\system\exception\SystemException;\r
+use wcf\system\WCF;\r
+use wcf\util\ClassUtil;\r
+\r
+/**\r
+ * Caches the merged group options of a group combination.\r
+ * \r
+ * @author     Marcel Werk\r
+ * @copyright  2001-2011 WoltLab GmbH\r
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>\r
+ * @package    com.woltlab.wcf\r
+ * @subpackage system.cache\r
+ * @category   Community Framework\r
+ */\r
+class CacheBuilderUserGroupPermission implements CacheBuilder {\r
+       protected $typeObjects = array();\r
+       \r
+       /**\r
+        * @see CacheBuilder::getData()\r
+        */\r
+       public function getData($cacheResource) {\r
+               list($cache, $packageID, $groupIDs) = explode('-', $cacheResource['cache']);\r
+               $data = array();\r
+               \r
+               // get all options and filter options with low priority\r
+               if ($packageID == 0) {\r
+                       // during the installation of the package wcf\r
+                       $sql = "SELECT          optionName, optionID \r
+                               FROM            wcf".WCF_N."_user_group_option\r
+                               WHERE           packageID IS NULL";\r
+                       $statement = WCF::getDB()->prepareStatement($sql);\r
+                       $statement->execute();\r
+               }\r
+               else {\r
+                       $sql = "SELECT          optionName, optionID \r
+                               FROM            wcf".WCF_N."_user_group_option option_table\r
+                               LEFT JOIN       wcf".WCF_N."_package_dependency package_dependency\r
+                               ON              (package_dependency.dependency = option_table.packageID)\r
+                               WHERE           package_dependency.packageID = ?\r
+                               ORDER BY        package_dependency.priority ASC";\r
+                       $statement = WCF::getDB()->prepareStatement($sql);\r
+                       $statement->execute(array($packageID));\r
+               }\r
+               \r
+               $options = array();\r
+               while ($row = $statement->fetchArray()) {\r
+                       $options[$row['optionName']] = $row['optionID'];\r
+               }\r
+               \r
+               if (count($options) > 0) {\r
+                       // get needed options\r
+                       $conditions = new PreparedStatementConditionBuilder();\r
+                       $conditions->add("option_value.groupID IN (?)", array(explode(',', $groupIDs)));\r
+                       $conditions->add("option_value.optionID IN (?)", array($options));\r
+                       \r
+                       $sql = "SELECT          option_table.optionName, option_table.optionType, option_value.optionValue\r
+                               FROM            wcf".WCF_N."_user_group_option_value option_value\r
+                               LEFT JOIN       wcf".WCF_N."_user_group_option option_table\r
+                               ON              (option_table.optionID = option_value.optionID)\r
+                               ".$conditions;\r
+                       $statement = WCF::getDB()->prepareStatement($sql);\r
+                       $statement->execute($conditions->getParameters());\r
+                       while ($row = $statement->fetchArray()) {\r
+                               if (!isset($data[$row['optionName']])) {\r
+                                       $data[$row['optionName']] = array('type' => $row['optionType'], 'values' => array());\r
+                               }\r
+                               \r
+                               $data[$row['optionName']]['values'][] = $row['optionValue'];\r
+                       }\r
+                       \r
+                       // merge values\r
+                       foreach ($data as $optionName => $option) {\r
+                               if (count($option['values']) == 1) {\r
+                                       $result = $option['values'][0];\r
+                               }\r
+                               else {\r
+                                       $typeObj = $this->getTypeObject($option['type']);\r
+                                       $result = $typeObj->merge($option['values']);\r
+                               }\r
+                               \r
+                               // unset false values\r
+                               if ($result === false) {\r
+                                       unset($data[$optionName]);\r
+                               }\r
+                               else {\r
+                                       $data[$optionName] = $result;\r
+                               }\r
+                       }\r
+               }\r
+               \r
+               $data['groupIDs'] = $groupIDs;\r
+               return $data;\r
+       }\r
+       \r
+       /**\r
+        * Returns an object of the requested group option type.\r
+        * \r
+        * @param       string                  $type\r
+        * @return      GroupOptionType\r
+        */\r
+       protected function getTypeObject($type) {\r
+               if (!isset($this->typeObjects[$type])) {\r
+                       $className = 'wcf\system\option\group\GroupOptionType'.ucfirst($type);\r
+                       \r
+                       // validate class\r
+                       if (!class_exists($className)) {\r
+                               throw new SystemException("unable to find class '".$className."'", 11001);\r
+                       }\r
+                       if (!ClassUtil::isInstanceOf($className, 'wcf\system\option\group\GroupOptionType')) {\r
+                               throw new SystemException("'".$className."' should implement GroupOptionType");\r
+                       }\r
+                       \r
+                       // create instance\r
+                       $this->typeObjects[$type] = new $className();\r
+               }\r
+               \r
+               return $this->typeObjects[$type];\r
+       }\r
+}\r
index 0afefe3f06b399c2eff22e0ea082b1a30777149c..277981ae9adb56d47f8339a64e9653f2ad982ded 100644 (file)
@@ -52,7 +52,7 @@ class CleanupHandler {
                CacheHandler::getInstance()->addResource(
                        'cleanupAdapter-'.PACKAGE_ID,
                        WCF_DIR.'cache/cache.cleanupAdapter.php',
-                       'wcf\system\cache\CacheBuilderCleanupAdapter'
+                       'wcf\system\cache\builder\CacheBuilderCleanupAdapter'
                );
                
                $this->cache = CacheHandler::getInstance()->get('cleanupAdapter');
index c5fbd33e3238d349e7e660ea5cfe4ae9e5093b94..526902f4e7f965ffc87a129797fddc1fda0a5f23 100644 (file)
@@ -188,7 +188,7 @@ abstract class CronjobScheduler {
         */
        protected static function getCache() {
                $cacheName = 'cronjobs-'.PACKAGE_ID;
-               CacheHandler::getInstance()->addResource($cacheName, WCF_DIR.'cache/cache.'.$cacheName.'.php', 'wcf\system\cache\CacheBuilderCronjob');
+               CacheHandler::getInstance()->addResource($cacheName, WCF_DIR.'cache/cache.'.$cacheName.'.php', 'wcf\system\cache\builder\CacheBuilderCronjob');
                
                return CacheHandler::getInstance()->get($cacheName);
        }
index 832c91c68738dec6d5fa4afa5c2c0e805195d3c4..0aa88bc825243b447e71b41667c86da9a20d95fc 100644 (file)
@@ -54,7 +54,7 @@ class EventHandler extends SingletonFactory {
         * Loads all registered actions of the active package.\r
         */\r
        protected function loadActions() {\r
-               CacheHandler::getInstance()->addResource('eventListener-'.PACKAGE_ID, WCF_DIR.'cache/cache.eventListener-'.PACKAGE_ID.'.php', 'wcf\system\cache\CacheBuilderEventListener');\r
+               CacheHandler::getInstance()->addResource('eventListener-'.PACKAGE_ID, WCF_DIR.'cache/cache.eventListener-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\CacheBuilderEventListener');\r
                $cache = CacheHandler::getInstance()->get('eventListener-'.PACKAGE_ID);\r
                if (isset($cache['actions'])) $this->actions = $cache['actions'];\r
                if (isset($cache['inheritedActions'])) $this->inheritedActions = $cache['inheritedActions'];\r
@@ -187,4 +187,4 @@ class EventHandler extends SingletonFactory {
        public static function generateKey($className, $eventName) {\r
                return $eventName.'@'.$className;\r
        }\r
-}
+}\r
index 6ebbc37d0d770b7a3f9551509f8430a1cef4e879..4af396bdd2579ffdd8a56cb897725ca7a6f6df58 100644 (file)
@@ -214,7 +214,7 @@ abstract class LanguageFactory {
                        CacheHandler::getInstance()->addResource(
                                'languages',
                                WCF_DIR.'cache/cache.languages.php',
-                               'wcf\system\cache\CacheBuilderLanguage'
+                               'wcf\system\cache\builder\CacheBuilderLanguage'
                        );
                        
                        self::$cache = CacheHandler::getInstance()->get('languages');
index cf95905e6ef4bbcbf1bf099cb8fb260a3c12ad7c..21b39c54f395ead31889f87e2eeea29941d0ed53 100644 (file)
@@ -24,7 +24,7 @@ class ACPMenu extends TreeMenu {
                        return;\r
                }\r
                \r
-               CacheHandler::getInstance()->addResource('menu-'.PACKAGE_ID, WCF_DIR.'cache/cache.menu-'.PACKAGE_ID.'.php', 'wcf\system\cache\CacheBuilderACPMenu');\r
+               CacheHandler::getInstance()->addResource('menu-'.PACKAGE_ID, WCF_DIR.'cache/cache.menu-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\CacheBuilderACPMenu');\r
                $this->menuItems = CacheHandler::getInstance()->get('menu-'.PACKAGE_ID);\r
        }\r
-}
+}\r
index 3e818aca8ddf3d56a5e6a3f936d265061ea9ca44..0eb9a51df4047fde028c511c44fbc5e1284f4602 100644 (file)
@@ -23,7 +23,7 @@ class PageMenu extends TreeMenu {
                parent::loadCache();\r
                \r
                // get cache\r
-               CacheHandler::getInstance()->addResource('pageMenu-'.PACKAGE_ID, WCF_DIR.'cache/cache.pageMenu-'.PACKAGE_ID.'.php', 'wcf\system\cache\CacheBuilderPageMenu');\r
+               CacheHandler::getInstance()->addResource('pageMenu-'.PACKAGE_ID, WCF_DIR.'cache/cache.pageMenu-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\CacheBuilderPageMenu');\r
                $this->menuItems = CacheHandler::getInstance()->get('pageMenu-'.PACKAGE_ID);\r
        }\r
        \r
@@ -35,4 +35,4 @@ class PageMenu extends TreeMenu {
                \r
                return $item->getProvider()->isVisible();\r
        }\r
-}
+}\r
index 0932e71deb123467229354aeb63056140b322fc7..2c1dec1af7d3763563310d2b4afeadc176725851 100644 (file)
@@ -72,7 +72,7 @@ abstract class PackageDependencyHandler {
                CacheHandler::getInstance()->addResource(
                        'packageDependencies-'.PACKAGE_ID,
                        WCF_DIR.'cache/cache.packageDependencies-'.PACKAGE_ID.'.php',
-                       'wcf\system\cache\CacheBuilderPackageDependency'
+                       'wcf\system\cache\builder\CacheBuilderPackageDependency'
                );
                
                self::$packageDependencyCache = CacheHandler::getInstance()->get('packageDependencies-'.PACKAGE_ID);
index bf8745a8c4e5a57931fdfab720d725c810695a8b..ce8f524eb3231c82546f31f8e6839e86630d97c1 100644 (file)
@@ -439,7 +439,7 @@ class SessionHandler extends SingletonFactory {
                CacheHandler::getInstance()->addResource(
                        'groups-'.PACKAGE_ID.'-'.$groups,
                        WCF_DIR.'cache/cache.groups-'.PACKAGE_ID.'-'.$groupsFileName.'.php',
-                       'wcf\system\cache\CacheBuilderUserGroupPermission'
+                       'wcf\system\cache\builder\CacheBuilderUserGroupPermission'
                );
                
                // get group data from cache
index 044891016e91b73f8e4b7e4d9f51ea13cd0b0202..e4a9c7e21398f1438c1cd6f860a8ed96ac6719e1 100644 (file)
@@ -34,7 +34,7 @@ class StyleHandler extends SingletonFactory {
         */
        protected function init() {
                // load cache
-               CacheHandler::getInstance()->addResource('styles', WCF_DIR.'cache/cache.styles.php', 'wcf\system\cache\CacheBuilderStyle');
+               CacheHandler::getInstance()->addResource('styles', WCF_DIR.'cache/cache.styles.php', 'wcf\system\cache\builder\CacheBuilderStyle');
                $this->cache = CacheHandler::getInstance()->get('styles');
        }
        
index 0eaa67b2891556743fdfb537b3105c62e4d493b8..2db0782ad48df816146eed11c66fe16bedf97375 100644 (file)
@@ -571,7 +571,7 @@ class TemplateEngine extends SingletonFactory {
         * Loads cached template group information.
         */
        protected function loadTemplateGroupCache() {
-               CacheHandler::getInstance()->addResource('templateGroups', WCF_DIR.'cache/cache.templateGroups.php', 'wcf\system\cache\CacheBuilderTemplateGroup');
+               CacheHandler::getInstance()->addResource('templateGroups', WCF_DIR.'cache/cache.templateGroups.php', 'wcf\system\cache\builder\CacheBuilderTemplateGroup');
                $this->templateGroupCache = CacheHandler::getInstance()->get('templateGroups');
        }
        
@@ -645,7 +645,7 @@ class TemplateEngine extends SingletonFactory {
                CacheHandler::getInstance()->addResource(
                        $cacheName,
                        WCF_DIR.'cache/cache.'.$cacheName.'.php',
-                       'wcf\system\cache\CacheBuilderTemplateListener'
+                       'wcf\system\cache\builder\CacheBuilderTemplateListener'
                );
                
                $this->templateListeners = CacheHandler::getInstance()->get($cacheName);
@@ -678,7 +678,7 @@ class TemplateEngine extends SingletonFactory {
                CacheHandler::getInstance()->addResource(
                        $cacheName,
                        WCF_DIR.'cache/templateListener/'.$cacheName.'.php',
-                       'wcf\system\cache\CacheBuilderTemplateListenerCode'
+                       'wcf\system\cache\builder\CacheBuilderTemplateListenerCode'
                );
                
                $this->templateListeners[$templateName] = CacheHandler::getInstance()->get($cacheName);