LanguageFactory::getInstance()->deleteLanguageCache();
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$conditions->add("isApplication = ?", array(1));
// get package dirs
$this->cacheData['version'] = WCF_VERSION;
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$conditions->add("isApplication = ?", array(1));
// get package dirs
$this->cacheData['version'] = phpversion('apc');
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$conditions->add("isApplication = ?", array(1));
// get package dirs
public function initObjectList() {
parent::initObjectList();
- $this->objectList->getConditionBuilder()->add("cronjob.packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $this->objectList->getConditionBuilder()->add("cronjob.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$this->sqlOrderBy = "cronjob.".$this->sortField." ".$this->sortOrder;
}
$this->objectList->sqlSelects = "cronjob.*";
$this->objectList->sqlJoins = "LEFT JOIN wcf".WCF_N."_cronjob cronjob ON (cronjob.cronjobID = cronjob_log.cronjobID)";
- $this->objectList->getConditionBuilder()->add("cronjob_log.cronjobID IN (SELECT cronjobID FROM wcf".WCF_N."_cronjob WHERE packageID IN (?))", array(PackageDependencyHandler::getDependencies()));
+ $this->objectList->getConditionBuilder()->add("cronjob_log.cronjobID IN (SELECT cronjobID FROM wcf".WCF_N."_cronjob WHERE packageID IN (?))", array(PackageDependencyHandler::getInstance()->getDependencies()));
}
/**
}
$conditionBuilder->add($searchCondition, $statementParameters);
- $conditionBuilder->add("packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $conditionBuilder->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
if ($languageID !== null) $conditionBuilder->add("languageID = ?", array($languageID));
// search
*/
public static function getPluginList() {
$pluginList = new PackageList();
- $pluginList->getConditionBuilder()->add("package.packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $pluginList->getConditionBuilder()->add("package.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$pluginList->getConditionBuilder()->add("package.isApplication = ?", array(0));
return $pluginList;
}
self::$coreObjectCache = CacheHandler::getInstance()->get('coreObjects-'.PACKAGE_ID);
- self::$packageDependencies = \wcf\system\package\PackageDependencyHandler::getDependencies();
+ self::$packageDependencies = \wcf\system\package\PackageDependencyHandler::getInstance()->getDependencies();
}
/**
*/
public function getData(array $cacheResource) {
$actionList = new ClipboardActionList();
- $actionList->getConditionBuilder()->add("packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $actionList->getConditionBuilder()->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$actionList->sqlLimit = 0;
$actionList->readObjects();
*/
public function getData(array $cacheResource) {
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$sql = "SELECT pageClassName, actionID
FROM wcf".WCF_N."_clipboard_page
$data = array();
$coreObjectList = new CoreObjectList();
- $coreObjectList->getConditionBuilder()->add("core_object.packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $coreObjectList->getConditionBuilder()->add("core_object.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$coreObjectList->sqlLimit = 0;
$coreObjectList->readObjects();
$coreObjects = $coreObjectList->getObjects();
public function getData(array $cacheResource) {
// get next execution time
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add("packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $conditionBuilder->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$sql = "SELECT MIN(nextExec) AS nextExec,
MIN(afterNextExec) AS afterNextExec
// get package dirs
$packageDirs = array();
$conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add("dependency.packageID IN (?) AND package.packageDir <> ''", array(PackageDependencyHandler::getDependencies()));
+ $conditionBuilder->add("dependency.packageID IN (?) AND package.packageDir <> ''", array(PackageDependencyHandler::getInstance()->getDependencies()));
$sql = "SELECT DISTINCT package.packageDir, dependency.priority
FROM wcf".WCF_N."_package_dependency dependency
LEFT JOIN wcf".WCF_N."_package package
$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()));
+ if (PACKAGE_ID) $templateListenerList->getConditionBuilder()->add("template_listener.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$templateListenerList->sqlLimit = 0;
$templateListenerList->readObjects();
$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->getConditionBuilder()->add("template_listener.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$templateListenerList->sqlLimit = 0;
$templateListenerList->readObjects();
*/
protected function loadCronjobs() {
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("cronjob.packageID IN (?)", array(PackageDependencyHandler::getDependencies()));
+ $conditions->add("cronjob.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$conditions->add("(cronjob.nextExec <= ? OR cronjob.afterNextExec <= ?)", array(TIME_NOW, TIME_NOW));
$conditions->add("cronjob.active = ?", array(1));
$conditions->add("cronjob.failCount < ?", array(3));
}
// determine if plugin is unique within current application
- $packageIDs = PackageDependencyHandler::getDependencies();
+ $packageIDs = PackageDependencyHandler::getInstance()->getDependencies();
foreach ($parentPackageIDs as $packageID) {
if (in_array($packageID, $packageIDs)) {
return true;
<?php
namespace wcf\system\package;
use wcf\system\cache\CacheHandler;
+use wcf\system\SingletonFactory;
/**
* PackageDependencyHandler stores package dependencies and providing a consistent interface for accessing.
*
* @author Alexander Ebert
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package
* @category Community Framework
*/
-abstract class PackageDependencyHandler {
+class PackageDependencyHandler extends SingletonFactory {
/**
* cache of package dependencies
*
* @var array
*/
- protected static $packageDependencyCache = null;
+ protected $packageDependencyCache = null;
+
+ /**
+ * @see wcf\system\SingletonFactory::init()
+ */
+ protected function init() {
+ $cacheName = 'packageDependencies-'.PACKAGE_ID;
+ CacheHandler::getInstance()->addResource(
+ $cacheName,
+ WCF_DIR.'cache/cache.'.$cacheName.'.php',
+ 'wcf\system\cache\builder\PackageDependencyCacheBuilder'
+ );
+
+ $this->packageDependencyCache = CacheHandler::getInstance()->get($cacheName);
+ }
/**
* Returns the id of a specific package in the active dependencies.
* @param string $package package identifier
* @return mixed
*/
- public static function getPackageID($package) {
+ public function getPackageID($package) {
if (!defined('PACKAGE_ID')) {
return null;
}
- if (self::$packageDependencyCache === null) {
- self::readCache();
- }
-
- if (isset(self::$packageDependencyCache['resolve'][$package])) {
- $packageID = self::$packageDependencyCache['resolve'][$package];
+ if (isset($this->packageDependencyCache['resolve'][$package])) {
+ $packageID = $this->packageDependencyCache['resolve'][$package];
if (is_array($packageID)) {
$packageID = array_shift($packageID);
*
* @return array
*/
- public static function getDependencies() {
+ public function getDependencies() {
if (!defined('PACKAGE_ID')) {
return null;
}
- if (self::$packageDependencyCache === null) {
- self::readCache();
- }
-
- return self::$packageDependencyCache['dependency'];
- }
-
- /**
- * Reads package dependency cache.
- */
- protected static function readCache() {
- $cacheName = 'packageDependencies-'.PACKAGE_ID;
- CacheHandler::getInstance()->addResource(
- $cacheName,
- WCF_DIR.'cache/cache.'.$cacheName.'.php',
- 'wcf\system\cache\builder\PackageDependencyCacheBuilder'
- );
-
- self::$packageDependencyCache = CacheHandler::getInstance()->get($cacheName);
+ return $this->packageDependencyCache['dependency'];
}
}
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", array($tmp));
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getDependencies($packageID)));
+ $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies($packageID)));
$sql = "SELECT *
FROM wcf".WCF_N."_user_storage