From: Matthias Schmidt Date: Wed, 20 Jul 2011 14:53:09 +0000 (+0200) Subject: CacheBuilder get their own folder/namespace X-Git-Tag: 2.0.0_Beta_1~1964^2~9^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ef8753573236c0b649faa5918969a486c6901c47;p=GitHub%2FWoltLab%2FWCF.git CacheBuilder get their own folder/namespace 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. --- diff --git a/wcfsetup/install/files/lib/acp/form/AbstractOptionListForm.class.php b/wcfsetup/install/files/lib/acp/form/AbstractOptionListForm.class.php index 8085e4b0e9..96b88e17c9 100755 --- a/wcfsetup/install/files/lib/acp/form/AbstractOptionListForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/AbstractOptionListForm.class.php @@ -38,7 +38,7 @@ abstract class AbstractOptionListForm extends AbstractForm { * cache class name * @var string */ - public $cacheClass = 'wcf\system\cache\CacheBuilderOption'; + public $cacheClass = 'wcf\system\cache\builder\CacheBuilderOption'; /** * list of all option categories diff --git a/wcfsetup/install/files/lib/acp/page/UserListPage.class.php b/wcfsetup/install/files/lib/acp/page/UserListPage.class.php index 7ec60a4510..b24a85ce9d 100755 --- a/wcfsetup/install/files/lib/acp/page/UserListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/UserListPage.class.php @@ -258,7 +258,7 @@ class UserListPage extends SortablePage { protected function readUserOptions() { // add cache resource $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'); // get options $this->options = CacheHandler::getInstance()->get($cacheName, 'options'); diff --git a/wcfsetup/install/files/lib/data/style/ActiveStyle.class.php b/wcfsetup/install/files/lib/data/style/ActiveStyle.class.php index e8a33271db..2d94ee9ab3 100644 --- a/wcfsetup/install/files/lib/data/style/ActiveStyle.class.php +++ b/wcfsetup/install/files/lib/data/style/ActiveStyle.class.php @@ -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); } diff --git a/wcfsetup/install/files/lib/data/user/User.class.php b/wcfsetup/install/files/lib/data/user/User.class.php index 944b891881..52e6585416 100644 --- a/wcfsetup/install/files/lib/data/user/User.class.php +++ b/wcfsetup/install/files/lib/data/user/User.class.php @@ -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'); } diff --git a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php index a6e1705e9e..39810f480c 100644 --- a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php +++ b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php @@ -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'); } } diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index ab74b4e79b..8eb198cb5b 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -297,10 +297,10 @@ class WCF { * Loads the default cache resources. */ protected function loadDefaultCacheResources() { - CacheHandler::getInstance()->addResource('languages', WCF_DIR.'cache/cache.languages.php', 'wcf\system\cache\CacheBuilderLanguage'); - CacheHandler::getInstance()->addResource('spiders', WCF_DIR.'cache/cache.spiders.php', 'wcf\system\cache\CacheBuilderSpider'); + CacheHandler::getInstance()->addResource('languages', WCF_DIR.'cache/cache.languages.php', 'wcf\system\cache\builder\CacheBuilderLanguage'); + CacheHandler::getInstance()->addResource('spiders', WCF_DIR.'cache/cache.spiders.php', 'wcf\system\builder\cache\CacheBuilderSpider'); if (defined('PACKAGE_ID')) { - CacheHandler::getInstance()->addResource('coreObjects-'.PACKAGE_ID, WCF_DIR.'cache/cache.coreObjects-'.PACKAGE_ID.'.php', 'wcf\system\cache\CacheBuilderCoreObject'); + CacheHandler::getInstance()->addResource('coreObjects-'.PACKAGE_ID, WCF_DIR.'cache/cache.coreObjects-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\CacheBuilderCoreObject'); } } @@ -561,4 +561,4 @@ class WCF { return null; } -} +} diff --git a/wcfsetup/install/files/lib/system/WCFACP.class.php b/wcfsetup/install/files/lib/system/WCFACP.class.php index 0fb2656dcd..504a09459e 100644 --- a/wcfsetup/install/files/lib/system/WCFACP.class.php +++ b/wcfsetup/install/files/lib/system/WCFACP.class.php @@ -93,7 +93,7 @@ class WCFACP extends WCF { */ protected function loadDefaultCacheResources() { parent::loadDefaultCacheResources(); - CacheHandler::getInstance()->addResource('packages', WCF_DIR.'cache/cache.packages.php', 'wcf\system\cache\CacheBuilderPackage'); + CacheHandler::getInstance()->addResource('packages', WCF_DIR.'cache/cache.packages.php', 'wcf\system\cache\builder\CacheBuilderPackage'); } /** @@ -174,4 +174,4 @@ class WCFACP extends WCF { } } } -} +} diff --git a/wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php b/wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php index 8c851b0bad..9e569c001a 100644 --- a/wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php +++ b/wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php @@ -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 index 592975656b..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderACPMenu.class.php +++ /dev/null @@ -1,151 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.cache - * @category Community Framework - */ -class CacheBuilderACPMenu implements CacheBuilder { - protected $optionCategoryStructure = array(); - - /** - * @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."_acp_menu_item menu_item - LEFT JOIN wcf".WCF_N."_package_dependency package_dependency - ON (menu_item.packageID = package_dependency.dependency) - 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) { - $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("menuItemID IN (?)", array($itemIDs)); - - // get needed menu items and build item tree - $sql = "SELECT menu_item.packageID, menuItem, parentMenuItem, - menuItemLink, permissions, options, packageDir - FROM wcf".WCF_N."_acp_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()) { - if (!isset($data[$row['parentMenuItem']])) { - $data[$row['parentMenuItem']] = array(); - } - - $data[$row['parentMenuItem']][] = new ACPMenuItem(null, $row); - } - } - - // get top option categories - $optionCategories = $this->getTopOptionCategories($packageID); - if (count($optionCategories) > 0) { - if (!isset($data['wcf.acp.menu.link.option.category'])) { - $data['wcf.acp.menu.link.option.category'] = array(); - } - - // get option category data - $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("categoryID IN (?)", array($optionCategories)); - - $sql = "SELECT * - FROM wcf".WCF_N."_option_category - ".$conditions." - ORDER BY showOrder ASC"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute($conditions->getParameters()); - while ($row = $statement->fetchArray()) { - $data['wcf.acp.menu.link.option.category'][] = new ACPMenuItem(null, array( - 'packageID' => $packageID, - 'menuItem' => 'wcf.acp.option.category.'.$row['categoryName'], - 'parentMenuItem' => 'wcf.acp.menu.link.option.category', - 'menuItemLink' => 'index.php?form=Option&categoryID='.$row['categoryID'], - 'packageDir' => '', - 'permissions' => $row['permissions'], - 'options' => $row['options'] - )); - } - } - - return $data; - } - - protected function getTopOptionCategories($packageID) { - // get all option categories and filter categories with low priority - $sql = "SELECT categoryName, categoryID - FROM wcf".WCF_N."_option_category option_category - LEFT JOIN wcf".WCF_N."_package_dependency package_dependency - ON (package_dependency.dependency = option_category.packageID) - WHERE package_dependency.packageID = ? - ORDER BY package_dependency.priority ASC"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($packageID)); - $optionCategories = array(); - while ($row = $statement->fetchArray()) { - $optionCategories[$row['categoryName']] = $row['categoryID']; - } - - $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("categoryID IN (?)", array($optionCategories)); - $statementParameters = $conditions->getParameters(); - array_unshift($statementParameters, $packageID); - - $sql = "SELECT categoryID, parentCategoryName, categoryName, - ( - SELECT COUNT(*) FROM wcf".WCF_N."_option WHERE categoryName = category.categoryName AND packageID IN ( - SELECT dependency FROM wcf".WCF_N."_package_dependency WHERE packageID = ? - ) - ) AS count - FROM wcf".WCF_N."_option_category category - ".$conditions; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute($statementParameters); - while ($row = $statement->fetchArray()) { - if (!isset($this->optionCategoryStructure[$row['parentCategoryName']])) $this->optionCategoryStructure[$row['parentCategoryName']] = array(); - $this->optionCategoryStructure[$row['parentCategoryName']][] = $row; - } - - $topOptionCategories = array(); - foreach ($this->optionCategoryStructure[''] as $optionCategory) { - $count = $optionCategory['count'] + $this->countOptions($optionCategory['categoryName']); - if ($count > 0) $topOptionCategories[] = $optionCategory['categoryID']; - } - - return $topOptionCategories; - } - - protected function countOptions($parentCategoryName) { - if (!isset($this->optionCategoryStructure[$parentCategoryName])) return 0; - - $count = 0; - foreach ($this->optionCategoryStructure[$parentCategoryName] as $optionCategory) { - $count += $optionCategory['count'] + $this->countOptions($optionCategory['categoryName']); - } - - return $count; - } -} 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 index 14e5b100e8..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderApplication.class.php +++ /dev/null @@ -1,79 +0,0 @@ - - * @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 index dff2a2b1cb..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderCleanupAdapter.class.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @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 index ba48eac4ee..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderCoreObject.class.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @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 index c8634e5486..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderCronjob.class.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @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 index 1afbbbeb9e..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderEventListener.class.php +++ /dev/null @@ -1,76 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.cache - * @category Community Framework - */ -class CacheBuilderEventListener implements CacheBuilder { - /** - * @see CacheBuilder::getData() - */ - public function getData($cacheResource) { - list($cache, $packageID) = explode('-', $cacheResource['cache']); - $data = array( - 'actions' => array('user' => array(), 'admin' => array()), - 'inheritedActions' => array('user' => array(), 'admin' => array()) - ); - - // get all listeners and filter options with low priority - $sql = "SELECT event_listener.* - FROM wcf".WCF_N."_event_listener event_listener - LEFT JOIN wcf".WCF_N."_package_dependency package_dependency - ON (package_dependency.dependency = event_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()) { - // distinguish between inherited actions and non-inherited actions - if (!$row['inherit']) { - $data['actions'][EventHandler::generateKey($row['eventClassName'], $row['eventName'])][] = $row; - } - else { - if (!isset($data['inheritedActions'][$row['eventClassName']])) $data['inheritedActions'][$row['eventClassName']] = array(); - $data['inheritedActions'][$row['eventClassName']][$row['eventName']][] = $row; - } - } - - // sort data by nice value and class name - foreach ($data['actions'] as $key => $listeners) { - uasort($data['actions'][$key], array(__CLASS__, 'sortListeners')); - } - - foreach ($data['inheritedActions'] as $class => $listeners) { - foreach ($listeners as $key => $val) { - uasort($data['inheritedActions'][$class][$key], array(__CLASS__, 'sortListeners')); - } - } - - return $data; - } - - /** - * Sorts the event listeners alphabetically. - */ - public static function sortListeners($listenerA, $listenerB) { - if ($listenerA['niceValue'] < $listenerB['niceValue']) { - return -1; - } - else if ($listenerA['niceValue'] > $listenerB['niceValue']) { - return 1; - } - else { - return strcmp($listenerA['listenerClassName'], $listenerB['listenerClassName']); - } - } -} 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 index 84e05efc2c..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderIcon.class.php +++ /dev/null @@ -1,90 +0,0 @@ - - * @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 index 1e026e1242..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderLanguage.class.php +++ /dev/null @@ -1,89 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.cache - * @category Community Framework - */ -class CacheBuilderLanguage implements CacheBuilder { - /** - * @see CacheBuilder::getData() - */ - public function getData($cacheResource) { - $languageToPackages = array(); - $data = array( - 'codes' => array(), - 'languages' => array(), - 'packages' => array(), - 'default' => 0, - 'categories' => array() - ); - - // get language to packages - $sql = "SELECT package.languageID, package.packageID - FROM wcf".WCF_N."_language_to_package package - LEFT JOIN wcf".WCF_N."_language language - ON (language.languageID = package.languageID) - ORDER BY language.isDefault DESC, - language.languageCode ASC"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(); - while ($row = $statement->fetchArray()) { - // package to languages - if (!isset($data['packages'][$row['packageID']])) { - $data['packages'][$row['packageID']] = array(); - } - $data['packages'][$row['packageID']][] = $row['languageID']; - - // language to packages - if (!isset($languageToPackages[$row['languageID']])) { - $languageToPackages[$row['languageID']] = array(); - } - $languageToPackages[$row['languageID']][] = $row['packageID']; - } - - // get languages - $sql = "SELECT * - FROM wcf".WCF_N."_language"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(); - while ($row = $statement->fetchArray()) { - // language data - $data['languages'][$row['languageID']] = $row; - - // language to packages - if (!isset($languageToPackages[$row['languageID']])) { - $languageToPackages[$row['languageID']] = array(); - } - $data['languages'][$row['languageID']]['packages'] = $languageToPackages[$row['languageID']]; - - // default language - if ($row['isDefault']) { - $data['default'] = $row['languageID']; - } - - // language code to language id - $data['codes'][$row['languageCode']] = $row['languageID']; - } - - // get language categories - $sql = "SELECT * - FROM wcf".WCF_N."_language_category"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(); - while ($row = $statement->fetchArray()) { - // package to languages - $data['categories'][$row['languageCategory']] = $row; - } - - return $data; - } -} 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 index ef31b6f915..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderOption.class.php +++ /dev/null @@ -1,116 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.cache - * @category Community Framework - */ -class CacheBuilderOption implements CacheBuilder { - /** - * @see CacheBuilder::getData() - */ - public function getData($cacheResource) { - $information = explode('-', $cacheResource['cache']); - if (count($information) == 3) { - $type = $information[0].'_'; - $packageID = $information[2]; - } - else { - $type = ''; - $packageID = $information[1]; - } - - $data = array( - 'categories' => array(), - 'options' => array(), - 'categoryStructure' => array(), - 'optionToCategories' => array() - ); - - // option categories - // get all option categories and sort categories by priority - $sql = "SELECT categoryName, categoryID - FROM wcf".WCF_N."_".$type."option_category option_category - LEFT JOIN wcf".WCF_N."_package_dependency package_dependency - ON (package_dependency.dependency = option_category.packageID) - WHERE package_dependency.packageID = ? - ORDER BY package_dependency.priority ASC"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($packageID)); - $optionCategories = array(); - while ($row = $statement->fetchArray()) { - $optionCategories[$row['categoryName']] = $row['categoryID']; - } - - if (count($optionCategories) > 0) { - // get needed option categories - $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("categoryID IN (?)", array($optionCategories)); - - $sql = "SELECT option_category.*, package.packageDir - FROM wcf".WCF_N."_".$type."option_category option_category - LEFT JOIN wcf".WCF_N."_package package - ON (package.packageID = option_category.packageID) - ".$conditions." - ORDER BY showOrder ASC"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute($conditions->getParameters()); - while ($row = $statement->fetchArray()) { - $data['categories'][$row['categoryName']] = new OptionCategory(null, $row); - if (!isset($data['categoryStructure'][$row['parentCategoryName']])) { - $data['categoryStructure'][$row['parentCategoryName']] = array(); - } - - $data['categoryStructure'][$row['parentCategoryName']][] = $row['categoryName']; - } - } - - // options - // get all options and sort options by priority - $optionIDs = array(); - $sql = "SELECT optionName, optionID - FROM wcf".WCF_N."_".$type."option option_table - LEFT JOIN wcf".WCF_N."_package_dependency package_dependency - ON (package_dependency.dependency = option_table.packageID) - WHERE package_dependency.packageID = ? - ORDER BY package_dependency.priority ASC"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($packageID)); - while ($row = $statement->fetchArray()) { - $optionIDs[$row['optionName']] = $row['optionID']; - } - - if (count($optionIDs) > 0) { - // get needed options - $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("optionID IN (?)", array($optionIDs)); - - $sql = "SELECT * - FROM wcf".WCF_N."_".$type."option - ".$conditions." - ORDER BY showOrder ASC"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute($conditions->getParameters()); - while ($row = $statement->fetchArray()) { - $data['options'][$row['optionName']] = new Option(null, $row); - if (!isset($data['optionToCategories'][$row['categoryName']])) { - $data['optionToCategories'][$row['categoryName']] = array(); - } - - $data['optionToCategories'][$row['categoryName']][] = $row['optionName']; - } - } - - return $data; - } -} 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 index 09ab660b35..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderPackage.class.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.cache - * @category Community Framework - */ -class CacheBuilderPackage implements CacheBuilder { - /** - * @see CacheBuilder::getData() - */ - public function getData($cacheResource) { - $packageList = new PackageList(); - $packageList->sqlLimit = 0; - $packageList->readObjects(); - - return $packageList->getObjects(); - } -} 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 index 49d5c119f9..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderPackageDependency.class.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @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 index 44e41f325a..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderPageMenu.class.php +++ /dev/null @@ -1,62 +0,0 @@ - - * @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 index 9020279c43..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderSpider.class.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.cache - * @category Community Framework - */ -class CacheBuilderSpider implements CacheBuilder { - /** - * @see CacheBuilder::getData() - */ - public function getData($cacheResource) { - $spiderList = new SpiderList(); - $spiderList->sqlOrderBy = "spider.spiderID ASC"; - $spiderList->sqlLimit = 0; - $spiderList->readObjects(); - - return $spiderList->getObjects(); - } -} 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 index 91d81b112a..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderStyle.class.php +++ /dev/null @@ -1,67 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.cache - * @category Community Framework - */ -class CacheBuilderStyle implements CacheBuilder { - /** - * @see CacheBuilder::getData() - */ - public function getData($cacheResource) { - $data = array('default' => 0, 'styles' => array(), 'packages' => array()); - - // get all styles - $sql = "SELECT * - FROM wcf".WCF_N."_style - ORDER BY styleName ASC"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(); - while ($row = $statement->fetchArray()) { - if ($row['isDefault']) $data['default'] = $row['styleID']; - $row['variables'] = array(); - - // get variable - $sql = "SELECT * - FROM wcf".WCF_N."_style_variable - WHERE styleID = ?"; - $statement2 = WCF::getDB()->prepareStatement($sql); - $statement2->execute(array($row['styleID'])); - while ($row = $statement2->fetchArray()) { - - $row['variables'][$row2['variableName']] = $row2['variableValue']; - } - - $data['styles'][$row['styleID']] = new Style(null, $row); - } - - // get style to packages - $sql = "SELECT * - FROM wcf".WCF_N."_style_to_package - ORDER BY packageID ASC"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(); - while ($row = $statement->fetchArray()) { - - if (!isset($data['packages'][$row['packageID']])) { - $data['packages'][$row['packageID']] = array('default' => 0, 'disabled' => array()); - } - - if ($row['isDefault']) { - $data['packages'][$row['packageID']]['default'] = $row['styleID']; - } - $data['packages'][$row['packageID']]['disabled'][$row['styleID']] = $row['disabled']; - } - - return $data; - } -} 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 index 8fda51eb06..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderTemplate.class.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.cache - * @category Community Framework - */ -class CacheBuilderTemplate implements CacheBuilder { - /** - * @see CacheBuilder::getData() - */ - public function getData($cacheResource) { - $information = explode('-', $cacheResource['cache']); - if (count($information) == 3) { - $prefix = $information[0].'_'; - $packageID = $information[2]; - } - else { - $prefix = ''; - $packageID = $information[1]; - } - - $data = array(); - - // get package directory for given package id - $sql = "SELECT packageDir - FROM wcf".WCF_N."_package - WHERE packageID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($packageID)); - $row = $statement->fetchArray(); - - // get all templates and filter options with low priority - $sql = "SELECT templateName, template.packageID - FROM wcf".WCF_N."_".$prefix."template template - LEFT JOIN wcf".WCF_N."_package_dependency package_dependency - ON (package_dependency.dependency = template.packageID) - WHERE package_dependency.packageID = ? - ORDER BY package_dependency.priority DESC"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($packageID)); - while ($row = $statement->fetchArray()) { - if (!isset($data[$row['templateName']]) || $packageID == $row['packageID']) { - $data[$row['templateName']] = $row['packageID']; - } - } - - return $data; - } -} 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 index 2ee84700df..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderTemplateGroup.class.php +++ /dev/null @@ -1,26 +0,0 @@ - - * @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 index d37802b071..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderTemplateListener.class.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @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 index a01db1a27d..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderTemplateListenerCode.class.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @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 index be28d794b3..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderUserGroup.class.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.cache - * @category Community Framework - */ -class CacheBuilderUserGroup implements CacheBuilder { - /** - * @see CacheBuilder::getData() - */ - public function getData($cacheResource) { - $data = array('types' => array(), 'groups' => array()); - - // get all user groups - $groupList = new UserGroupList(); - $groupList->sqlOrderBy = "user_group.groupName"; - $groupList->sqlLimit = 0; - $groupList->readObjects(); - $groups = $groupList->getObjects(); - - foreach ($groups as $group) { - if (!isset($data['types'][$group->groupType])) { - $data['types'][$group->groupType] = array(); - } - - $data['types'][$group->groupType][] = $group->groupID; - $data['groups'][$group->groupID] = $group; - } - - return $data; - } -} 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 index 0b7042345f..0000000000 --- a/wcfsetup/install/files/lib/system/cache/CacheBuilderUserGroupPermission.class.php +++ /dev/null @@ -1,122 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.cache - * @category Community Framework - */ -class CacheBuilderUserGroupPermission implements CacheBuilder { - protected $typeObjects = array(); - - /** - * @see CacheBuilder::getData() - */ - public function getData($cacheResource) { - list($cache, $packageID, $groupIDs) = explode('-', $cacheResource['cache']); - $data = array(); - - // get all options and filter options with low priority - if ($packageID == 0) { - // during the installation of the package wcf - $sql = "SELECT optionName, optionID - FROM wcf".WCF_N."_user_group_option - WHERE packageID IS NULL"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(); - } - else { - $sql = "SELECT optionName, optionID - FROM wcf".WCF_N."_user_group_option option_table - LEFT JOIN wcf".WCF_N."_package_dependency package_dependency - ON (package_dependency.dependency = option_table.packageID) - WHERE package_dependency.packageID = ? - ORDER BY package_dependency.priority ASC"; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array($packageID)); - } - - $options = array(); - while ($row = $statement->fetchArray()) { - $options[$row['optionName']] = $row['optionID']; - } - - if (count($options) > 0) { - // get needed options - $conditions = new PreparedStatementConditionBuilder(); - $conditions->add("option_value.groupID IN (?)", array(explode(',', $groupIDs))); - $conditions->add("option_value.optionID IN (?)", array($options)); - - $sql = "SELECT option_table.optionName, option_table.optionType, option_value.optionValue - FROM wcf".WCF_N."_user_group_option_value option_value - LEFT JOIN wcf".WCF_N."_user_group_option option_table - ON (option_table.optionID = option_value.optionID) - ".$conditions; - $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute($conditions->getParameters()); - while ($row = $statement->fetchArray()) { - if (!isset($data[$row['optionName']])) { - $data[$row['optionName']] = array('type' => $row['optionType'], 'values' => array()); - } - - $data[$row['optionName']]['values'][] = $row['optionValue']; - } - - // merge values - foreach ($data as $optionName => $option) { - if (count($option['values']) == 1) { - $result = $option['values'][0]; - } - else { - $typeObj = $this->getTypeObject($option['type']); - $result = $typeObj->merge($option['values']); - } - - // unset false values - if ($result === false) { - unset($data[$optionName]); - } - else { - $data[$optionName] = $result; - } - } - } - - $data['groupIDs'] = $groupIDs; - return $data; - } - - /** - * Returns an object of the requested group option type. - * - * @param string $type - * @return GroupOptionType - */ - protected function getTypeObject($type) { - if (!isset($this->typeObjects[$type])) { - $className = 'wcf\system\option\group\GroupOptionType'.ucfirst($type); - - // validate class - if (!class_exists($className)) { - throw new SystemException("unable to find class '".$className."'", 11001); - } - if (!ClassUtil::isInstanceOf($className, 'wcf\system\option\group\GroupOptionType')) { - throw new SystemException("'".$className."' should implement GroupOptionType"); - } - - // create instance - $this->typeObjects[$type] = new $className(); - } - - return $this->typeObjects[$type]; - } -} 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 index 0000000000..fc504cfb5b --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderACPMenu.class.php @@ -0,0 +1,151 @@ + + * @package com.woltlab.wcf + * @subpackage system.cache + * @category Community Framework + */ +class CacheBuilderACPMenu implements CacheBuilder { + protected $optionCategoryStructure = array(); + + /** + * @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."_acp_menu_item menu_item + LEFT JOIN wcf".WCF_N."_package_dependency package_dependency + ON (menu_item.packageID = package_dependency.dependency) + 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) { + $conditions = new PreparedStatementConditionBuilder(); + $conditions->add("menuItemID IN (?)", array($itemIDs)); + + // get needed menu items and build item tree + $sql = "SELECT menu_item.packageID, menuItem, parentMenuItem, + menuItemLink, permissions, options, packageDir + FROM wcf".WCF_N."_acp_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()) { + if (!isset($data[$row['parentMenuItem']])) { + $data[$row['parentMenuItem']] = array(); + } + + $data[$row['parentMenuItem']][] = new ACPMenuItem(null, $row); + } + } + + // get top option categories + $optionCategories = $this->getTopOptionCategories($packageID); + if (count($optionCategories) > 0) { + if (!isset($data['wcf.acp.menu.link.option.category'])) { + $data['wcf.acp.menu.link.option.category'] = array(); + } + + // get option category data + $conditions = new PreparedStatementConditionBuilder(); + $conditions->add("categoryID IN (?)", array($optionCategories)); + + $sql = "SELECT * + FROM wcf".WCF_N."_option_category + ".$conditions." + ORDER BY showOrder ASC"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute($conditions->getParameters()); + while ($row = $statement->fetchArray()) { + $data['wcf.acp.menu.link.option.category'][] = new ACPMenuItem(null, array( + 'packageID' => $packageID, + 'menuItem' => 'wcf.acp.option.category.'.$row['categoryName'], + 'parentMenuItem' => 'wcf.acp.menu.link.option.category', + 'menuItemLink' => 'index.php?form=Option&categoryID='.$row['categoryID'], + 'packageDir' => '', + 'permissions' => $row['permissions'], + 'options' => $row['options'] + )); + } + } + + return $data; + } + + protected function getTopOptionCategories($packageID) { + // get all option categories and filter categories with low priority + $sql = "SELECT categoryName, categoryID + FROM wcf".WCF_N."_option_category option_category + LEFT JOIN wcf".WCF_N."_package_dependency package_dependency + ON (package_dependency.dependency = option_category.packageID) + WHERE package_dependency.packageID = ? + ORDER BY package_dependency.priority ASC"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($packageID)); + $optionCategories = array(); + while ($row = $statement->fetchArray()) { + $optionCategories[$row['categoryName']] = $row['categoryID']; + } + + $conditions = new PreparedStatementConditionBuilder(); + $conditions->add("categoryID IN (?)", array($optionCategories)); + $statementParameters = $conditions->getParameters(); + array_unshift($statementParameters, $packageID); + + $sql = "SELECT categoryID, parentCategoryName, categoryName, + ( + SELECT COUNT(*) FROM wcf".WCF_N."_option WHERE categoryName = category.categoryName AND packageID IN ( + SELECT dependency FROM wcf".WCF_N."_package_dependency WHERE packageID = ? + ) + ) AS count + FROM wcf".WCF_N."_option_category category + ".$conditions; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute($statementParameters); + while ($row = $statement->fetchArray()) { + if (!isset($this->optionCategoryStructure[$row['parentCategoryName']])) $this->optionCategoryStructure[$row['parentCategoryName']] = array(); + $this->optionCategoryStructure[$row['parentCategoryName']][] = $row; + } + + $topOptionCategories = array(); + foreach ($this->optionCategoryStructure[''] as $optionCategory) { + $count = $optionCategory['count'] + $this->countOptions($optionCategory['categoryName']); + if ($count > 0) $topOptionCategories[] = $optionCategory['categoryID']; + } + + return $topOptionCategories; + } + + protected function countOptions($parentCategoryName) { + if (!isset($this->optionCategoryStructure[$parentCategoryName])) return 0; + + $count = 0; + foreach ($this->optionCategoryStructure[$parentCategoryName] as $optionCategory) { + $count += $optionCategory['count'] + $this->countOptions($optionCategory['categoryName']); + } + + return $count; + } +} 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 index 0000000000..c9eca9f552 --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderApplication.class.php @@ -0,0 +1,79 @@ + + * @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 index 0000000000..2846cf62a2 --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderCleanupAdapter.class.php @@ -0,0 +1,50 @@ + + * @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 index 0000000000..33abc690a5 --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderCoreObject.class.php @@ -0,0 +1,42 @@ + + * @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 index 0000000000..68f62bbda3 --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderCronjob.class.php @@ -0,0 +1,39 @@ + + * @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 index 0000000000..47ca8feece --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderEventListener.class.php @@ -0,0 +1,76 @@ + + * @package com.woltlab.wcf + * @subpackage system.cache + * @category Community Framework + */ +class CacheBuilderEventListener implements CacheBuilder { + /** + * @see CacheBuilder::getData() + */ + public function getData($cacheResource) { + list($cache, $packageID) = explode('-', $cacheResource['cache']); + $data = array( + 'actions' => array('user' => array(), 'admin' => array()), + 'inheritedActions' => array('user' => array(), 'admin' => array()) + ); + + // get all listeners and filter options with low priority + $sql = "SELECT event_listener.* + FROM wcf".WCF_N."_event_listener event_listener + LEFT JOIN wcf".WCF_N."_package_dependency package_dependency + ON (package_dependency.dependency = event_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()) { + // distinguish between inherited actions and non-inherited actions + if (!$row['inherit']) { + $data['actions'][EventHandler::generateKey($row['eventClassName'], $row['eventName'])][] = $row; + } + else { + if (!isset($data['inheritedActions'][$row['eventClassName']])) $data['inheritedActions'][$row['eventClassName']] = array(); + $data['inheritedActions'][$row['eventClassName']][$row['eventName']][] = $row; + } + } + + // sort data by nice value and class name + foreach ($data['actions'] as $key => $listeners) { + uasort($data['actions'][$key], array(__CLASS__, 'sortListeners')); + } + + foreach ($data['inheritedActions'] as $class => $listeners) { + foreach ($listeners as $key => $val) { + uasort($data['inheritedActions'][$class][$key], array(__CLASS__, 'sortListeners')); + } + } + + return $data; + } + + /** + * Sorts the event listeners alphabetically. + */ + public static function sortListeners($listenerA, $listenerB) { + if ($listenerA['niceValue'] < $listenerB['niceValue']) { + return -1; + } + else if ($listenerA['niceValue'] > $listenerB['niceValue']) { + return 1; + } + else { + return strcmp($listenerA['listenerClassName'], $listenerB['listenerClassName']); + } + } +} 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 index 0000000000..4c93eaffbd --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderIcon.class.php @@ -0,0 +1,90 @@ + + * @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 index 0000000000..844ce46b24 --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderLanguage.class.php @@ -0,0 +1,89 @@ + + * @package com.woltlab.wcf + * @subpackage system.cache + * @category Community Framework + */ +class CacheBuilderLanguage implements CacheBuilder { + /** + * @see CacheBuilder::getData() + */ + public function getData($cacheResource) { + $languageToPackages = array(); + $data = array( + 'codes' => array(), + 'languages' => array(), + 'packages' => array(), + 'default' => 0, + 'categories' => array() + ); + + // get language to packages + $sql = "SELECT package.languageID, package.packageID + FROM wcf".WCF_N."_language_to_package package + LEFT JOIN wcf".WCF_N."_language language + ON (language.languageID = package.languageID) + ORDER BY language.isDefault DESC, + language.languageCode ASC"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(); + while ($row = $statement->fetchArray()) { + // package to languages + if (!isset($data['packages'][$row['packageID']])) { + $data['packages'][$row['packageID']] = array(); + } + $data['packages'][$row['packageID']][] = $row['languageID']; + + // language to packages + if (!isset($languageToPackages[$row['languageID']])) { + $languageToPackages[$row['languageID']] = array(); + } + $languageToPackages[$row['languageID']][] = $row['packageID']; + } + + // get languages + $sql = "SELECT * + FROM wcf".WCF_N."_language"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(); + while ($row = $statement->fetchArray()) { + // language data + $data['languages'][$row['languageID']] = $row; + + // language to packages + if (!isset($languageToPackages[$row['languageID']])) { + $languageToPackages[$row['languageID']] = array(); + } + $data['languages'][$row['languageID']]['packages'] = $languageToPackages[$row['languageID']]; + + // default language + if ($row['isDefault']) { + $data['default'] = $row['languageID']; + } + + // language code to language id + $data['codes'][$row['languageCode']] = $row['languageID']; + } + + // get language categories + $sql = "SELECT * + FROM wcf".WCF_N."_language_category"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(); + while ($row = $statement->fetchArray()) { + // package to languages + $data['categories'][$row['languageCategory']] = $row; + } + + return $data; + } +} 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 index 0000000000..8266060745 --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderOption.class.php @@ -0,0 +1,116 @@ + + * @package com.woltlab.wcf + * @subpackage system.cache + * @category Community Framework + */ +class CacheBuilderOption implements CacheBuilder { + /** + * @see CacheBuilder::getData() + */ + public function getData($cacheResource) { + $information = explode('-', $cacheResource['cache']); + if (count($information) == 3) { + $type = $information[0].'_'; + $packageID = $information[2]; + } + else { + $type = ''; + $packageID = $information[1]; + } + + $data = array( + 'categories' => array(), + 'options' => array(), + 'categoryStructure' => array(), + 'optionToCategories' => array() + ); + + // option categories + // get all option categories and sort categories by priority + $sql = "SELECT categoryName, categoryID + FROM wcf".WCF_N."_".$type."option_category option_category + LEFT JOIN wcf".WCF_N."_package_dependency package_dependency + ON (package_dependency.dependency = option_category.packageID) + WHERE package_dependency.packageID = ? + ORDER BY package_dependency.priority ASC"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($packageID)); + $optionCategories = array(); + while ($row = $statement->fetchArray()) { + $optionCategories[$row['categoryName']] = $row['categoryID']; + } + + if (count($optionCategories) > 0) { + // get needed option categories + $conditions = new PreparedStatementConditionBuilder(); + $conditions->add("categoryID IN (?)", array($optionCategories)); + + $sql = "SELECT option_category.*, package.packageDir + FROM wcf".WCF_N."_".$type."option_category option_category + LEFT JOIN wcf".WCF_N."_package package + ON (package.packageID = option_category.packageID) + ".$conditions." + ORDER BY showOrder ASC"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute($conditions->getParameters()); + while ($row = $statement->fetchArray()) { + $data['categories'][$row['categoryName']] = new OptionCategory(null, $row); + if (!isset($data['categoryStructure'][$row['parentCategoryName']])) { + $data['categoryStructure'][$row['parentCategoryName']] = array(); + } + + $data['categoryStructure'][$row['parentCategoryName']][] = $row['categoryName']; + } + } + + // options + // get all options and sort options by priority + $optionIDs = array(); + $sql = "SELECT optionName, optionID + FROM wcf".WCF_N."_".$type."option option_table + LEFT JOIN wcf".WCF_N."_package_dependency package_dependency + ON (package_dependency.dependency = option_table.packageID) + WHERE package_dependency.packageID = ? + ORDER BY package_dependency.priority ASC"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($packageID)); + while ($row = $statement->fetchArray()) { + $optionIDs[$row['optionName']] = $row['optionID']; + } + + if (count($optionIDs) > 0) { + // get needed options + $conditions = new PreparedStatementConditionBuilder(); + $conditions->add("optionID IN (?)", array($optionIDs)); + + $sql = "SELECT * + FROM wcf".WCF_N."_".$type."option + ".$conditions." + ORDER BY showOrder ASC"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute($conditions->getParameters()); + while ($row = $statement->fetchArray()) { + $data['options'][$row['optionName']] = new Option(null, $row); + if (!isset($data['optionToCategories'][$row['categoryName']])) { + $data['optionToCategories'][$row['categoryName']] = array(); + } + + $data['optionToCategories'][$row['categoryName']][] = $row['optionName']; + } + } + + return $data; + } +} 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 index 0000000000..bd01e09ce4 --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderPackage.class.php @@ -0,0 +1,27 @@ + + * @package com.woltlab.wcf + * @subpackage system.cache + * @category Community Framework + */ +class CacheBuilderPackage implements CacheBuilder { + /** + * @see CacheBuilder::getData() + */ + public function getData($cacheResource) { + $packageList = new PackageList(); + $packageList->sqlLimit = 0; + $packageList->readObjects(); + + return $packageList->getObjects(); + } +} 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 index 0000000000..254294ff0d --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderPackageDependency.class.php @@ -0,0 +1,60 @@ + + * @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 index 0000000000..f968c29b39 --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderPageMenu.class.php @@ -0,0 +1,62 @@ + + * @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 index 0000000000..0e5aca178e --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderSpider.class.php @@ -0,0 +1,27 @@ + + * @package com.woltlab.wcf + * @subpackage system.cache + * @category Community Framework + */ +class CacheBuilderSpider implements CacheBuilder { + /** + * @see CacheBuilder::getData() + */ + public function getData($cacheResource) { + $spiderList = new SpiderList(); + $spiderList->sqlOrderBy = "spider.spiderID ASC"; + $spiderList->sqlLimit = 0; + $spiderList->readObjects(); + + return $spiderList->getObjects(); + } +} 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 index 0000000000..9654d6130d --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderStyle.class.php @@ -0,0 +1,67 @@ + + * @package com.woltlab.wcf + * @subpackage system.cache + * @category Community Framework + */ +class CacheBuilderStyle implements CacheBuilder { + /** + * @see CacheBuilder::getData() + */ + public function getData($cacheResource) { + $data = array('default' => 0, 'styles' => array(), 'packages' => array()); + + // get all styles + $sql = "SELECT * + FROM wcf".WCF_N."_style + ORDER BY styleName ASC"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(); + while ($row = $statement->fetchArray()) { + if ($row['isDefault']) $data['default'] = $row['styleID']; + $row['variables'] = array(); + + // get variable + $sql = "SELECT * + FROM wcf".WCF_N."_style_variable + WHERE styleID = ?"; + $statement2 = WCF::getDB()->prepareStatement($sql); + $statement2->execute(array($row['styleID'])); + while ($row = $statement2->fetchArray()) { + + $row['variables'][$row2['variableName']] = $row2['variableValue']; + } + + $data['styles'][$row['styleID']] = new Style(null, $row); + } + + // get style to packages + $sql = "SELECT * + FROM wcf".WCF_N."_style_to_package + ORDER BY packageID ASC"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(); + while ($row = $statement->fetchArray()) { + + if (!isset($data['packages'][$row['packageID']])) { + $data['packages'][$row['packageID']] = array('default' => 0, 'disabled' => array()); + } + + if ($row['isDefault']) { + $data['packages'][$row['packageID']]['default'] = $row['styleID']; + } + $data['packages'][$row['packageID']]['disabled'][$row['styleID']] = $row['disabled']; + } + + return $data; + } +} 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 index 0000000000..d03724da2b --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplate.class.php @@ -0,0 +1,57 @@ + + * @package com.woltlab.wcf + * @subpackage system.cache + * @category Community Framework + */ +class CacheBuilderTemplate implements CacheBuilder { + /** + * @see CacheBuilder::getData() + */ + public function getData($cacheResource) { + $information = explode('-', $cacheResource['cache']); + if (count($information) == 3) { + $prefix = $information[0].'_'; + $packageID = $information[2]; + } + else { + $prefix = ''; + $packageID = $information[1]; + } + + $data = array(); + + // get package directory for given package id + $sql = "SELECT packageDir + FROM wcf".WCF_N."_package + WHERE packageID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($packageID)); + $row = $statement->fetchArray(); + + // get all templates and filter options with low priority + $sql = "SELECT templateName, template.packageID + FROM wcf".WCF_N."_".$prefix."template template + LEFT JOIN wcf".WCF_N."_package_dependency package_dependency + ON (package_dependency.dependency = template.packageID) + WHERE package_dependency.packageID = ? + ORDER BY package_dependency.priority DESC"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($packageID)); + while ($row = $statement->fetchArray()) { + if (!isset($data[$row['templateName']]) || $packageID == $row['packageID']) { + $data[$row['templateName']] = $row['packageID']; + } + } + + return $data; + } +} 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 index 0000000000..dc69ce2c1c --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplateGroup.class.php @@ -0,0 +1,26 @@ + + * @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 index 0000000000..b73a437b16 --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplateListener.class.php @@ -0,0 +1,38 @@ + + * @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 index 0000000000..40d3a14100 --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderTemplateListenerCode.class.php @@ -0,0 +1,38 @@ + + * @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 index 0000000000..d5316a427d --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderUserGroup.class.php @@ -0,0 +1,40 @@ + + * @package com.woltlab.wcf + * @subpackage system.cache + * @category Community Framework + */ +class CacheBuilderUserGroup implements CacheBuilder { + /** + * @see CacheBuilder::getData() + */ + public function getData($cacheResource) { + $data = array('types' => array(), 'groups' => array()); + + // get all user groups + $groupList = new UserGroupList(); + $groupList->sqlOrderBy = "user_group.groupName"; + $groupList->sqlLimit = 0; + $groupList->readObjects(); + $groups = $groupList->getObjects(); + + foreach ($groups as $group) { + if (!isset($data['types'][$group->groupType])) { + $data['types'][$group->groupType] = array(); + } + + $data['types'][$group->groupType][] = $group->groupID; + $data['groups'][$group->groupID] = $group; + } + + return $data; + } +} 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 index 0000000000..9e50abd383 --- /dev/null +++ b/wcfsetup/install/files/lib/system/cache/builder/CacheBuilderUserGroupPermission.class.php @@ -0,0 +1,122 @@ + + * @package com.woltlab.wcf + * @subpackage system.cache + * @category Community Framework + */ +class CacheBuilderUserGroupPermission implements CacheBuilder { + protected $typeObjects = array(); + + /** + * @see CacheBuilder::getData() + */ + public function getData($cacheResource) { + list($cache, $packageID, $groupIDs) = explode('-', $cacheResource['cache']); + $data = array(); + + // get all options and filter options with low priority + if ($packageID == 0) { + // during the installation of the package wcf + $sql = "SELECT optionName, optionID + FROM wcf".WCF_N."_user_group_option + WHERE packageID IS NULL"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(); + } + else { + $sql = "SELECT optionName, optionID + FROM wcf".WCF_N."_user_group_option option_table + LEFT JOIN wcf".WCF_N."_package_dependency package_dependency + ON (package_dependency.dependency = option_table.packageID) + WHERE package_dependency.packageID = ? + ORDER BY package_dependency.priority ASC"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($packageID)); + } + + $options = array(); + while ($row = $statement->fetchArray()) { + $options[$row['optionName']] = $row['optionID']; + } + + if (count($options) > 0) { + // get needed options + $conditions = new PreparedStatementConditionBuilder(); + $conditions->add("option_value.groupID IN (?)", array(explode(',', $groupIDs))); + $conditions->add("option_value.optionID IN (?)", array($options)); + + $sql = "SELECT option_table.optionName, option_table.optionType, option_value.optionValue + FROM wcf".WCF_N."_user_group_option_value option_value + LEFT JOIN wcf".WCF_N."_user_group_option option_table + ON (option_table.optionID = option_value.optionID) + ".$conditions; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute($conditions->getParameters()); + while ($row = $statement->fetchArray()) { + if (!isset($data[$row['optionName']])) { + $data[$row['optionName']] = array('type' => $row['optionType'], 'values' => array()); + } + + $data[$row['optionName']]['values'][] = $row['optionValue']; + } + + // merge values + foreach ($data as $optionName => $option) { + if (count($option['values']) == 1) { + $result = $option['values'][0]; + } + else { + $typeObj = $this->getTypeObject($option['type']); + $result = $typeObj->merge($option['values']); + } + + // unset false values + if ($result === false) { + unset($data[$optionName]); + } + else { + $data[$optionName] = $result; + } + } + } + + $data['groupIDs'] = $groupIDs; + return $data; + } + + /** + * Returns an object of the requested group option type. + * + * @param string $type + * @return GroupOptionType + */ + protected function getTypeObject($type) { + if (!isset($this->typeObjects[$type])) { + $className = 'wcf\system\option\group\GroupOptionType'.ucfirst($type); + + // validate class + if (!class_exists($className)) { + throw new SystemException("unable to find class '".$className."'", 11001); + } + if (!ClassUtil::isInstanceOf($className, 'wcf\system\option\group\GroupOptionType')) { + throw new SystemException("'".$className."' should implement GroupOptionType"); + } + + // create instance + $this->typeObjects[$type] = new $className(); + } + + return $this->typeObjects[$type]; + } +} diff --git a/wcfsetup/install/files/lib/system/cleanup/CleanupHandler.class.php b/wcfsetup/install/files/lib/system/cleanup/CleanupHandler.class.php index 0afefe3f06..277981ae9a 100644 --- a/wcfsetup/install/files/lib/system/cleanup/CleanupHandler.class.php +++ b/wcfsetup/install/files/lib/system/cleanup/CleanupHandler.class.php @@ -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'); diff --git a/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php b/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php index c5fbd33e32..526902f4e7 100644 --- a/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/CronjobScheduler.class.php @@ -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); } diff --git a/wcfsetup/install/files/lib/system/event/EventHandler.class.php b/wcfsetup/install/files/lib/system/event/EventHandler.class.php index 832c91c687..0aa88bc825 100644 --- a/wcfsetup/install/files/lib/system/event/EventHandler.class.php +++ b/wcfsetup/install/files/lib/system/event/EventHandler.class.php @@ -54,7 +54,7 @@ class EventHandler extends SingletonFactory { * Loads all registered actions of the active package. */ protected function loadActions() { - CacheHandler::getInstance()->addResource('eventListener-'.PACKAGE_ID, WCF_DIR.'cache/cache.eventListener-'.PACKAGE_ID.'.php', 'wcf\system\cache\CacheBuilderEventListener'); + CacheHandler::getInstance()->addResource('eventListener-'.PACKAGE_ID, WCF_DIR.'cache/cache.eventListener-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\CacheBuilderEventListener'); $cache = CacheHandler::getInstance()->get('eventListener-'.PACKAGE_ID); if (isset($cache['actions'])) $this->actions = $cache['actions']; if (isset($cache['inheritedActions'])) $this->inheritedActions = $cache['inheritedActions']; @@ -187,4 +187,4 @@ class EventHandler extends SingletonFactory { public static function generateKey($className, $eventName) { return $eventName.'@'.$className; } -} +} diff --git a/wcfsetup/install/files/lib/system/language/LanguageFactory.class.php b/wcfsetup/install/files/lib/system/language/LanguageFactory.class.php index 6ebbc37d0d..4af396bdd2 100644 --- a/wcfsetup/install/files/lib/system/language/LanguageFactory.class.php +++ b/wcfsetup/install/files/lib/system/language/LanguageFactory.class.php @@ -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'); diff --git a/wcfsetup/install/files/lib/system/menu/acp/ACPMenu.class.php b/wcfsetup/install/files/lib/system/menu/acp/ACPMenu.class.php index cf95905e6e..21b39c54f3 100644 --- a/wcfsetup/install/files/lib/system/menu/acp/ACPMenu.class.php +++ b/wcfsetup/install/files/lib/system/menu/acp/ACPMenu.class.php @@ -24,7 +24,7 @@ class ACPMenu extends TreeMenu { return; } - CacheHandler::getInstance()->addResource('menu-'.PACKAGE_ID, WCF_DIR.'cache/cache.menu-'.PACKAGE_ID.'.php', 'wcf\system\cache\CacheBuilderACPMenu'); + CacheHandler::getInstance()->addResource('menu-'.PACKAGE_ID, WCF_DIR.'cache/cache.menu-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\CacheBuilderACPMenu'); $this->menuItems = CacheHandler::getInstance()->get('menu-'.PACKAGE_ID); } -} +} diff --git a/wcfsetup/install/files/lib/system/menu/page/PageMenu.class.php b/wcfsetup/install/files/lib/system/menu/page/PageMenu.class.php index 3e818aca8d..0eb9a51df4 100644 --- a/wcfsetup/install/files/lib/system/menu/page/PageMenu.class.php +++ b/wcfsetup/install/files/lib/system/menu/page/PageMenu.class.php @@ -23,7 +23,7 @@ class PageMenu extends TreeMenu { parent::loadCache(); // get cache - CacheHandler::getInstance()->addResource('pageMenu-'.PACKAGE_ID, WCF_DIR.'cache/cache.pageMenu-'.PACKAGE_ID.'.php', 'wcf\system\cache\CacheBuilderPageMenu'); + CacheHandler::getInstance()->addResource('pageMenu-'.PACKAGE_ID, WCF_DIR.'cache/cache.pageMenu-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\CacheBuilderPageMenu'); $this->menuItems = CacheHandler::getInstance()->get('pageMenu-'.PACKAGE_ID); } @@ -35,4 +35,4 @@ class PageMenu extends TreeMenu { return $item->getProvider()->isVisible(); } -} +} diff --git a/wcfsetup/install/files/lib/system/package/PackageDependencyHandler.class.php b/wcfsetup/install/files/lib/system/package/PackageDependencyHandler.class.php index 0932e71deb..2c1dec1af7 100644 --- a/wcfsetup/install/files/lib/system/package/PackageDependencyHandler.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageDependencyHandler.class.php @@ -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); diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index bf8745a8c4..ce8f524eb3 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -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 diff --git a/wcfsetup/install/files/lib/system/style/StyleHandler.class.php b/wcfsetup/install/files/lib/system/style/StyleHandler.class.php index 044891016e..e4a9c7e213 100644 --- a/wcfsetup/install/files/lib/system/style/StyleHandler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleHandler.class.php @@ -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'); } diff --git a/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php b/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php index 0eaa67b289..2db0782ad4 100644 --- a/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php +++ b/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php @@ -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);