Other packages aren't modified yet and I cannot guarantee that the installation will work at all. I will check this after applying these changes to all existing packages.
use wcf\action\AbstractAction;
use wcf\system\cache\CacheHandler;
use wcf\system\exception\SystemException;
-use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\language\LanguageFactory;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;
use wcf\util\FileUtil;
// delete language cache and compiled templates as well
LanguageFactory::getInstance()->deleteLanguageCache();
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("isApplication = ?", array(1));
-
// get package dirs
$sql = "SELECT packageDir
FROM wcf".WCF_N."_package
- ".$conditions;
+ WHERE isApplication = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
+ $statement->execute(array(1));
while ($row = $statement->fetchArray()) {
$packageDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
try {
use wcf\data\page\menu\item\PageMenuItemList;
use wcf\system\exception\UserInputException;
use wcf\system\language\I18nHandler;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\WCF;
use wcf\util\StringUtil;
*/
protected function initAvailableParentMenuItems() {
$this->availableParentMenuItems = new PageMenuItemList();
- $this->availableParentMenuItems->getConditionBuilder()->add("page_menu_item.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$this->availableParentMenuItems->getConditionBuilder()->add("page_menu_item.parentMenuItem = ''");
$this->availableParentMenuItems->sqlOrderBy = "page_menu_item.showOrder ASC";
}
<?php
namespace wcf\acp\form;
-use wcf\data\user\group\option\UserGroupOptionAction;
-
use wcf\data\user\group\option\category\UserGroupOptionCategoryList;
use wcf\data\user\group\option\UserGroupOption;
+use wcf\data\user\group\option\UserGroupOptionAction;
use wcf\data\user\group\UserGroup;
use wcf\data\DatabaseObject;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\exception\SystemException;
use wcf\system\exception\UserInputException;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\WCF;
/**
}
// verify options and permissions for current option
+ throw new SystemException("UserGroupOptionForm::readParameters()");
$dependencies = PackageDependencyHandler::getInstance()->getDependencies();
if ($this->verifyPermissions($this->userGroupOption) && in_array($this->userGroupOption->packageID, $dependencies)) {
// read all categories
namespace wcf\acp\page;
use wcf\system\menu\acp\ACPMenu;
use wcf\page\AbstractPage;
-use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\cache\source\MemcacheAdapter;
use wcf\system\cache\CacheHandler;
use wcf\system\exception\SystemException;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\Regex;
use wcf\system\WCF;
use wcf\util\FileUtil;
// set version
$this->cacheData['version'] = WCF_VERSION;
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("isApplication = ?", array(1));
-
// get package dirs
$sql = "SELECT packageDir
FROM wcf".WCF_N."_package
- ".$conditions;
+ WHERE isApplication = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
+ $statement->execute(array(1));
while ($row = $statement->fetchArray()) {
$packageDir = FileUtil::getRealPath(WCF_DIR.$row['packageDir']);
$this->readCacheFiles('data', $packageDir.'cache');
// set version
$this->cacheData['version'] = WCF_VERSION;
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("isApplication = ?", array(1));
-
// get package dirs
$sql = "SELECT packageDir
FROM wcf".WCF_N."_package
- ".$conditions;
+ WHERE isApplication = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
+ $statement->execute(array(1));
while ($row = $statement->fetchArray()) {
$packageDir = FileUtil::getRealPath(WCF_DIR.$row['packageDir']);
$this->readCacheFiles('data', $packageDir.'cache');
// set version
$this->cacheData['version'] = phpversion('apc');
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("isApplication = ?", array(1));
-
// get package dirs
$sql = "SELECT packageDir, packageName, instanceNo
FROM wcf".WCF_N."_package
- ".$conditions;
+ WHERE isApplication = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
+ $statement->execute(array(1));
$packageNames = array();
while ($row = $statement->fetchArray()) {
namespace wcf\acp\page;
use wcf\page\SortablePage;
use wcf\system\menu\acp\ACPMenu;
-use wcf\system\package\PackageDependencyHandler;
/**
* Shows information about configured cron jobs.
public function initObjectList() {
parent::initObjectList();
- $this->objectList->getConditionBuilder()->add("cronjob.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$this->sqlOrderBy = "cronjob.".$this->sortField." ".$this->sortOrder;
}
namespace wcf\acp\page;
use wcf\page\SortablePage;
use wcf\system\menu\acp\ACPMenu;
-use wcf\system\package\PackageDependencyHandler;
/**
* Shows cronjob log information.
$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::getInstance()->getDependencies()));
}
/**
use wcf\data\page\menu\item\ViewablePageMenuItem;
use wcf\page\AbstractPage;
use wcf\system\menu\acp\ACPMenu;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\WCF;
/**
parent::readData();
$menuItemList = new PageMenuItemList();
- $menuItemList->getConditionBuilder()->add("page_menu_item.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$menuItemList->sqlOrderBy = "page_menu_item.parentMenuItem ASC, page_menu_item.showOrder ASC";
$menuItemList->readObjects();
* Gets the user options from cache.
*/
protected function readUserOptions() {
- $cacheName = 'user-option-'.PACKAGE_ID;
CacheHandler::getInstance()->addResource(
- $cacheName,
- WCF_DIR.'cache/cache.'.$cacheName.'.php',
+ 'userOption',
+ WCF_DIR.'cache/cache.userOption.php',
'wcf\system\cache\builder\OptionCacheBuilder'
);
- $this->options = CacheHandler::getInstance()->get($cacheName, 'options');
+ $this->options = CacheHandler::getInstance()->get('userOption', 'options');
foreach ($this->options as &$option) {
$option = new ViewableUserOption($option);
if (isset($parameters['userID']) && !$parameters['userID']) {
$parameters['userID'] = null;
}
- if (isset($parameters['packageID']) && !$parameters['packageID']) {
- $parameters['packageID'] = null;
- }
return parent::create($parameters);
}
if (isset($parameters['userID']) && !$parameters['userID']) {
$parameters['userID'] = null;
}
- if (isset($parameters['packageID']) && !$parameters['packageID']) {
- $parameters['packageID'] = null;
- }
return parent::update($parameters);
}
/**
* Assigns a list of applications to a group and computes cookie domain and path.
*/
- public function group() {
+ public function rebuild() {
if (empty($this->objects)) {
$this->readObjects();
}
$sql = "UPDATE wcf".WCF_N."_application
- SET groupID = ?,
- cookieDomain = ?,
+ SET cookieDomain = ?,
cookiePath = ?,
isPrimary = ?
WHERE packageID = ?";
$isPrimary = ($this->parameters['primaryApplication'] == $packageID) ? 1 : 0;
$statement->execute(array(
- $this->parameters['groupID'],
$domainName,
$path,
$isPrimary,
$this->rebuild();
}
-
- /**
- * Removes a list of applications from their group and resets the cookie domain and path.
- */
- public function ungroup() {
- if (empty($this->objects)) {
- $this->readObjects();
- }
-
- $sql = "UPDATE wcf".WCF_N."_application
- SET groupID = ?,
- cookieDomain = domainName,
- cookiePath = domainPath,
- isPrimary = 0
- WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
-
- WCF::getDB()->beginTransaction();
- foreach ($this->objects as $application) {
- $statement->execute(array(
- null,
- $application->packageID
- ));
- }
- WCF::getDB()->commitTransaction();
-
- $this->rebuild();
- }
-
- /**
- * Rebuilds application cache and dependencies.
- */
- protected function rebuild() {
- foreach ($this->objects as $application) {
- // reset cache
- $directory = PackageCache::getInstance()->getPackage($application->packageID)->packageDir;
- $directory = FileUtil::getRealPath(WCF_DIR.$directory);
-
- CacheHandler::getInstance()->clear($directory.'cache', '*.php');
-
- // rebuild dependencies
- Package::rebuildPackageDependencies($application->packageID);
- }
- }
}
+++ /dev/null
-<?php
-namespace wcf\data\application\group;
-use wcf\data\DatabaseObject;
-
-/**
- * Represents an application group.
- *
- * @author Alexander Ebert
- * @copyright 2001-2012 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage data.application.group
- * @category Community Framework
- */
-class ApplicationGroup extends DatabaseObject {
- /**
- * @see wcf\data\DatabaseObject::$databaseTableName
- */
- protected static $databaseTableName = 'application_group';
-
- /**
- * @see wcf\data\DatabaseObject::$databaseTableIndexName
- */
- protected static $databaseTableIndexName = 'groupID';
-}
+++ /dev/null
-<?php
-namespace wcf\data\application\group;
-use wcf\data\application\ApplicationAction;
-use wcf\data\application\ApplicationList;
-use wcf\data\AbstractDatabaseObjectAction;
-use wcf\system\cache\CacheHandler;
-use wcf\system\language\LanguageFactory;
-
-/**
- * Executes application group-related actions.
- *
- * @author Alexander Ebert
- * @copyright 2001-2012 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage data.application.group
- * @category Community Framework
- */
-class ApplicationGroupAction extends AbstractDatabaseObjectAction {
- /**
- * @see wcf\data\AbstractDatabaseObjectAction::$className
- */
- protected $className = 'wcf\data\application\group\ApplicationGroupEditor';
-
- /**
- * @see wcf\data\AbstractDatabaseObjectAction::$permissionsDelete
- */
- protected $permissionsDelete = array('admin.system.canManageApplication');
-
- /**
- * @see wcf\data\AbstractDatabaseObjectAction::create()
- */
- public function create() {
- $applicationGroup = parent::create();
-
- $applicationAction = new ApplicationAction($this->parameters['applications'], 'group', array(
- 'groupID' => $applicationGroup->groupID,
- 'primaryApplication' => $this->parameters['primaryApplication']
- ));
- $applicationAction->executeAction();
-
- return $applicationGroup;
- }
-
- /**
- * @see wcf\data\AbstractDatabaseObjectAction::update()
- */
- public function update() {
- parent::update();
-
- // read list of currently associated applications
- $applicationGroup = current(reset($this->objects));
- $applicationList = new ApplicationList();
- $applicationList->getConditionBuilder()->add("application.groupID = ?", array($applicationGroup->groupID));
- $applicationList->sqlLimit = 0;
- $applicationList->readObjects();
-
- $updateApplications = $removeApplications = array();
- foreach ($applicationList as $application) {
- $index = array_search($application->packageID, $this->parameters['applications']);
- if ($index === false) {
- $removeApplications[] = $application;
- }
- else {
- // already existing
- $updateApplications[] = $application;
- unset($this->parameters['applications'][$index]);
- }
- }
-
- if (!empty($this->parameters['applications'])) {
- $applicationList = new ApplicationList();
- $applicationList->getConditionBuilder()->add("application.packageID IN (?)", $this->parameters['applications']);
- $applicationList->sqlLimit = 0;
- $applicationList->readObjects();
- $updateApplications = array_merge($updateApplications, $applicationList->getObjects());
- }
-
- // rebuild current group
- $applicationAction = new ApplicationAction($updateApplications, 'group', array(
- 'groupID' => $applicationGroup->groupID,
- 'primaryApplication' => $this->parameters['primaryApplication']
- ));
- $applicationAction->executeAction();
-
- // remove applications from group
- if (!empty($removeApplications)) {
- $applicationAction = new ApplicationAction($removeApplications, 'ungroup');
- $applicationAction->executeAction();
- }
-
- $this->clearCache();
- }
-
- /**
- * @see wcf\data\AbstractDatabaseObjectAction::delete()
- */
- public function delete() {
- // read all associated applications
- $applicationGroup = current($this->objects);
- $applicationList = new ApplicationList();
- $applicationList->getConditionBuilder()->add("application.groupID = ?", array($applicationGroup->groupID));
- $applicationList->sqlLimit = 0;
- $applicationList->readObjects();
-
- $applicationAction = new ApplicationAction($applicationList->getObjects(), 'ungroup');
- $applicationAction->executeAction();
-
- $this->clearCache();
-
- return parent::delete();
- }
-
- /**
- * Clears WCF cache.
- */
- protected function clearCache() {
- // delete language cache and compiled templates
- LanguageFactory::getInstance()->deleteLanguageCache();
-
- // delete WCF cache
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', '*.php');
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/templateListener', '*.php');
- }
-}
+++ /dev/null
-<?php
-namespace wcf\data\application\group;
-use wcf\data\DatabaseObjectEditor;
-
-/**
- * Provides functions to edit application groups.
- *
- * @author Alexander Ebert
- * @copyright 2001-2012 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage data.application.group
- * @category Community Framework
- */
-class ApplicationGroupEditor extends DatabaseObjectEditor {
- /**
- * @see wcf\data\DatabaseObjectDecorator::$baseClass
- */
- protected static $baseClass = 'wcf\data\application\group\ApplicationGroup';
-}
+++ /dev/null
-<?php
-namespace wcf\data\application\group;
-use wcf\data\DatabaseObjectList;
-
-/**
- * Represents a list of application groups.
- *
- * @author Alexander Ebert
- * @copyright 2001-2012 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage data.application.group
- * @category Community Framework
- */
-class ApplicationGroupList extends DatabaseObjectList {
- /**
- * @see wcf\data\DatabaseObjectList::$className
- */
- public $className = 'wcf\data\application\group\ApplicationGroup';
-}
+++ /dev/null
-<?php
-namespace wcf\data\application\group;
-use wcf\data\application\ViewableApplication;
-use wcf\data\DatabaseObjectDecorator;
-
-/**
- * Provides a viewable application group.
- *
- * @author Alexander Ebert
- * @copyright 2001-2012 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage data.application.group
- * @category Community Framework
- */
-class ViewableApplicationGroup extends DatabaseObjectDecorator implements \Countable, \Iterator {
- /**
- * @see wcf\data\DatabaseObjectDecorator::$baseClass
- */
- protected static $baseClass = 'wcf\data\application\group\ApplicationGroup';
-
- /**
- * list of viewable applications
- * @var array<wcf\data\application\ViewableApplication>
- */
- protected $applications = array();
-
- /**
- * current iterator index
- * @var integer
- */
- protected $index = 0;
-
- /**
- * Assigns an application to this group.
- *
- * @param wcf\data\application\ViewableApplication $application
- */
- public function addApplication(ViewableApplication $application) {
- if ($this->groupID == $application->groupID) {
- $this->applications[] = $application;
- }
- }
-
- /**
- * @see \Countable::count()
- */
- public function count() {
- return count($this->applications);
- }
-
- /**
- * @see \Iterator::current()
- */
- public function current() {
- return $this->applications[$this->index];
- }
-
- /**
- * @see \Iterator::key()
- */
- public function key() {
- return $this->applications[$this->index];
- }
-
- /**
- * @see \Iterator::next()
- */
- public function next() {
- ++$this->index;
- }
-
- /**
- * @see \Iterator::rewind()
- */
- public function rewind() {
- $this->index = 0;
- }
-
- /**
- * @see \Iterator::valid()
- */
- public function valid() {
- return isset($this->applications[$this->index]);
- }
-}
* @see wcf\data\IEditableCachedObject::resetCache()
*/
public static function resetCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.category-'.PACKAGE_ID.'.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.category.php');
}
}
*/
const EXECUTING = 2;
+ /**
+ * maximum number of allowed fails
+ */
+ const MAX_FAIL_COUNT = 3;
+
/**
* Returns timestamp of next execution.
*
* @see wcf\data\IEditableCachedObject::resetCache()
*/
public static function resetCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.cronjobs-*');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.cronjob.php');
}
}
/**
* Deletes the cronjob log.
*/
- public static function clearLogs($packageID = PACKAGE_ID) {
+ public static function clearLogs() {
// delete logs
- $sql = "DELETE FROM wcf".WCF_N."_cronjob_log
- WHERE cronjobID IN (
- SELECT cronjobID
- FROM wcf".WCF_N."_cronjob cronjob,
- wcf".WCF_N."_package_dependency package_dependency
- WHERE cronjob.packageID = package_dependency.dependency
- AND package_dependency.packageID = ?
- )";
+ $sql = "DELETE FROM wcf".WCF_N."_cronjob_log";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute();
}
}
use wcf\system\exception\SystemException;
use wcf\system\io\File;
use wcf\system\language\LanguageFactory;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\Regex;
use wcf\system\WCF;
use wcf\util\DirectoryUtil;
$conditions->add("languageCategoryID = ?", array($categoryID));
// get language items
- if ($packageID === 0) {
- // update after wcf installation
- $conditions->add("packageID IS NULL");
-
- $sql = "SELECT languageItem, languageItemValue, languageCustomItemValue, languageUseCustomValue
- FROM wcf".WCF_N."_language_item
- ".$conditions;
- }
- else {
- // update after regular package installation or update or manual import
- $conditions->add("package_dependency.packageID = ?", array($packageID));
-
- $sql = "SELECT languageItem, languageItemValue, languageCustomItemValue, languageUseCustomValue
- FROM wcf".WCF_N."_language_item language_item
- LEFT JOIN wcf".WCF_N."_package_dependency package_dependency
- ON (package_dependency.dependency = language_item.packageID)
- ".$conditions."
- ORDER BY package_dependency.priority ASC";
- }
+ $conditions->add("packageID IS NULL");
+ $sql = "SELECT languageItem, languageItemValue, languageCustomItemValue, languageUseCustomValue
+ FROM wcf".WCF_N."_language_item
+ ".$conditions;
$statement2 = WCF::getDB()->prepareStatement($sql);
$statement2->execute($conditions->getParameters());
*/
public function export($packageIDArray = array(), $exportCustomValues = false) {
$conditions = new PreparedStatementConditionBuilder();
+ $conditions->add("language_item.languageID = ?", array($this->languageID));
// bom
echo "\xEF\xBB\xBF";
// get items
$items = array();
if (!empty($packageIDArray)) {
- // sql conditions
$conditions->add("language_item.packageID IN (?)", array($packageIDArray));
- $conditions->add("language_item.languageID = ?", array($this->languageID));
-
- $sql = "SELECT languageItem, " . ($exportCustomValues ? "CASE WHEN languageUseCustomValue > 0 THEN languageCustomItemValue ELSE languageItemValue END AS languageItemValue" : "languageItemValue") . ", languageCategory
- FROM wcf".WCF_N."_language_item language_item
- LEFT JOIN wcf".WCF_N."_language_category language_category
- ON (language_category.languageCategoryID = language_item.languageCategoryID)
- ".$conditions;
- }
- else {
- // sql conditions
- $conditions->add("language_item.packageID = package_dependency.dependency");
- $conditions->add("package_dependency.packageID = ?", array(PACKAGE_ID));
- $conditions->add("language_item.languageID = ?", array($this->languageID));
-
- $sql = "SELECT languageItem, " . ($exportCustomValues ? "CASE WHEN languageUseCustomValue > 0 THEN languageCustomItemValue ELSE languageItemValue END AS languageItemValue" : "languageItemValue") . ", languageCategory
- FROM wcf".WCF_N."_package_dependency package_dependency,
- wcf".WCF_N."_language_item language_item
- LEFT JOIN wcf".WCF_N."_language_category language_category
- ON (language_category.languageCategoryID = language_item.languageCategoryID)
- ".$conditions."
- ORDER BY package_dependency.priority ASC";
}
+
+ $sql = "SELECT languageItem, " . ($exportCustomValues ? "CASE WHEN languageUseCustomValue > 0 THEN languageCustomItemValue ELSE languageItemValue END AS languageItemValue" : "languageItemValue") . ", languageCategory
+ FROM wcf".WCF_N."_language_item language_item
+ LEFT JOIN wcf".WCF_N."_language_category language_category
+ ON (language_category.languageCategoryID = language_item.languageCategoryID)
+ ".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
// find existing language items
$languageItemList = new LanguageItemList();
- $languageItemList->sqlJoins = "LEFT JOIN wcf".WCF_N."_package_dependency package_dependency ON (package_dependency.dependency = language_item.packageID)";
- $languageItemList->getConditionBuilder()->add("package_dependency.packageID = ?", array($packageID));
$languageItemList->getConditionBuilder()->add("language_item.languageItem IN (?)", array(array_keys($items)));
$languageItemList->getConditionBuilder()->add("languageID = ?", array($this->languageID));
- $languageItemList->sqlOrderBy = "package_dependency.priority ASC";
$languageItemList->sqlLimit = 0;
$languageItemList->readObjects();
* Clears language cache.
*/
public function clearCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.languages.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.language.php');
}
/**
}
$conditionBuilder->add($searchCondition, $statementParameters);
- $conditionBuilder->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
if ($languageID !== null) $conditionBuilder->add("languageID = ?", array($languageID));
// search
*/
protected function init() {
// get definition cache
- CacheHandler::getInstance()->addResource('objectType-'.PACKAGE_ID, WCF_DIR.'cache/cache.objectType-'.PACKAGE_ID.'.php', 'wcf\system\cache\builder\ObjectTypeCacheBuilder');
- $this->definitionsByCategory = CacheHandler::getInstance()->get('objectType-'.PACKAGE_ID, 'categories');
- $this->definitions = CacheHandler::getInstance()->get('objectType-'.PACKAGE_ID, 'definitions');
+ CacheHandler::getInstance()->addResource(
+ 'objectType',
+ WCF_DIR.'cache/cache.objectType.php',
+ 'wcf\system\cache\builder\ObjectTypeCacheBuilder'
+ );
+ $this->definitionsByCategory = CacheHandler::getInstance()->get('objectType', 'categories');
+ $this->definitions = CacheHandler::getInstance()->get('objectType', 'definitions');
foreach ($this->definitions as $definition) {
$this->definitionsByName[$definition->definitionName] = $definition;
}
// get object type cache
- $this->objectTypes = CacheHandler::getInstance()->get('objectType-'.PACKAGE_ID, 'objectTypes');
+ $this->objectTypes = CacheHandler::getInstance()->get('objectType', 'objectTypes');
foreach ($this->objectTypes as $objectType) {
$definition = $this->getDefinition($objectType->definitionID);
if (!isset($this->groupedObjectTypes[$definition->definitionName])) {
* Resets and reloads the object type cache.
*/
public function resetCache() {
- CacheHandler::getInstance()->clearResource('objectType-'.PACKAGE_ID);
+ CacheHandler::getInstance()->clearResource('objectType');
$this->init();
}
}
/**
* Returns a list of options.
*
- * @param integer $packageID
* @return array<wcf\data\option\Option>
*/
- public static function getOptions($packageID = PACKAGE_ID) {
+ public static function getOptions() {
$sql = "SELECT option_table.*,
package.package, package.isApplication,
parent_package.package AS parentPackage,
parent_package.isApplication AS parentPackageIsApplication
- FROM wcf".WCF_N."_package_dependency package_dependency,
- wcf".WCF_N."_option option_table
+ FROM wcf".WCF_N."_option option_table
LEFT JOIN wcf".WCF_N."_package package
ON (package.packageID = option_table.packageID)
LEFT JOIN wcf".WCF_N."_package parent_package
- ON (parent_package.packageID = package.parentPackageID)
- WHERE package_dependency.dependency = option_table.packageID
- AND package_dependency.packageID = ?";
+ ON (parent_package.packageID = package.parentPackageID)";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute();
while ($row = $statement->fetchArray()) {
$option = new Option(null, $row);
$options[$option->getConstantName()] = $option;
public static function import(array $options) {
// get option ids
$sql = "SELECT optionName, optionID
- FROM wcf".WCF_N."_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";
+ FROM wcf".WCF_N."_option";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(PACKAGE_ID));
+ $statement->execute();
$optionIDs = array();
while ($row = $statement->fetchArray()) {
$optionIDs[$row['optionName']] = $row['optionID'];
*/
public static function resetCache() {
// reset cache
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.option-*.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.option.php');
// reset options.inc.php files
$sql = "SELECT package, packageID, packageDir
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\exception\SystemException;
use wcf\system\io\File;
-use wcf\system\package\PackageDependencyHandler;
+use wcf\system\package\PackageInstallationDispatcher;
use wcf\system\WCF;
use wcf\util\FileUtil;
use wcf\util\StringUtil;
*/
public function getDependencies() {
if ($this->dependencies === null) {
- $this->dependencies = array();
-
- $sql = "SELECT package.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName
- 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 packageName ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($this->packageID));
- while ($package = $statement->fetchObject('wcf\data\package\Package')) {
- $this->dependencies[$package->packageID] = $package;
- }
+ throw new SystemException("Package::getDependencies()");
}
return $this->dependencies;
}
}
- /**
- * Rebuilds the dependencies list for the given package id.
- *
- * @param integer $packageID
- */
- public static function rebuildPackageDependencies($packageID) {
- // delete old dependencies
- $sql = "DELETE FROM wcf".WCF_N."_package_dependency
- WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
-
- // get all requirements of this package
- $allRequirements = array($packageID);
- $sql = "SELECT requirement
- FROM wcf".WCF_N."_package_requirement_map
- WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
- while ($row = $statement->fetchArray()) {
- $allRequirements[] = $row['requirement'];
- }
-
- // find their plugins
- $requirements = $allRequirements;
- do {
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (SELECT packageID FROM wcf".WCF_N."_package WHERE parentPackageID IN (?))", array($requirements));
- $conditions->add("requirement NOT IN (?)", array($allRequirements));
-
- $sql = "SELECT DISTINCT requirement
- FROM wcf".WCF_N."_package_requirement_map
- ".$conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
- $requirements = array();
- while ($row = $statement->fetchArray()) {
- $requirements[] = $row['requirement'];
- $allRequirements[] = $row['requirement'];
- }
- }
- while (!empty($requirements));
-
- // rebuild
- // select requirements
- $conditions = new PreparedStatementConditionBuilder(false);
- $conditions->add("requirement IN (?)", array($allRequirements));
-
- $statementParameters = $conditions->getParameters();
- $statementParameters[] = $packageID;
- $statementParameters[] = $packageID;
-
- $requirements = array();
- $sql = "SELECT requirement, level
- FROM wcf".WCF_N."_package_requirement_map
- WHERE ".$conditions."
- AND requirement NOT IN ( -- exclude dependencies to other installations of same package
- SELECT packageID
- FROM wcf".WCF_N."_package
- WHERE package = (
- SELECT package
- FROM wcf".WCF_N."_package
- WHERE packageID = ?
- )
- AND packageID <> ?
- )
- ORDER BY level ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($statementParameters);
- while ($row = $statement->fetchArray()) {
- $requirements[$row['requirement']] = $row['level'];
- }
-
- // insert requirements
- $sql = "INSERT INTO wcf".WCF_N."_package_dependency
- (packageID, dependency, priority)
- VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
-
- $insertedDependencies = self::insertApplicationDependencies($packageID, $statement);
- $shiftPriority = (empty($insertedDependencies)) ? false : true;
- foreach ($requirements as $dependency => $priority) {
- $statement->execute(array(
- $packageID,
- $dependency,
- ($shiftPriority ? ($priority + 1) : $priority)
- ));
-
- if (!isset($insertedDependencies[$packageID])) {
- $insertedDependencies[$packageID] = array();
- }
-
- $insertedDependencies[$packageID][] = $dependency;
- }
-
- // select plugins
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("parentPackageID IN (?)", array($allRequirements));
-
- $plugins = array();
- $sql = "SELECT packageID,
- (
- SELECT MAX(level) AS level
- FROM wcf".WCF_N."_package_requirement_map
- WHERE packageID = package.packageID
- ) AS requirementLevel
- FROM wcf".WCF_N."_package package
- ".$conditions."
- ORDER BY requirementLevel ASC";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
- while ($row = $statement->fetchArray()) {
- $row['requirementLevel'] = intval($row['requirementLevel']) + 1;
- $plugins[$row['packageID']] = $row['requirementLevel'];
- }
-
- // insert plugins
- $sql = "INSERT INTO wcf".WCF_N."_package_dependency
- (packageID, dependency, priority)
- VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
- foreach ($plugins as $dependency => $priority) {
- // ignore already inserted dependencies
- if (isset($insertedDependencies[$packageID]) && in_array($dependency, $insertedDependencies[$packageID])) {
- continue;
- }
-
- $statement->execute(array($packageID, $dependency, $priority));
- }
-
- // in some cases (e.g. if rebuilding dependencies for WCF) it is very likely, that
- // there is always a dependency on the package itself. This was avoided in the past
- // by using INSERT IGNORE, thus we have to validate if a self-depdendency already
- // exist before inserting.
- $sql = "SELECT COUNT(*) AS count
- FROM wcf".WCF_N."_package_dependency
- WHERE packageID = ?
- AND dependency = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
- $packageID,
- $packageID
- ));
- $row = $statement->fetchArray();
-
- // no dependencies on the package itself exists yet
- if (!$row['count']) {
- // self insert
- $sql = "SELECT (MAX(priority) + 1) AS priority
- FROM wcf".WCF_N."_package_dependency";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute();
-
- $row = $statement->fetchArray();
- if (!$row || !$row['priority']) {
- $row['priority'] = 0;
- }
-
- $sql = "INSERT INTO wcf".WCF_N."_package_dependency
- (packageID, dependency, priority)
- VALUES (?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID, $packageID, $row['priority']));
- }
- }
-
- /**
- * Inserts dependencies on applications within the same application group.
- *
- * @param integer $packageID
- * @param wcf\system\database\statement\PreparedStatement $insertStatement
- * @return array<string>
- */
- protected static function insertApplicationDependencies($packageID, PreparedStatement $insertStatement) {
- $insertedDependencies = array();
-
- // check for application group
- $sql = "SELECT groupID
- FROM wcf".WCF_N."_application
- WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
- $row = $statement->fetchArray();
- if ($row !== false && $row['groupID'] !== null) {
- // select application ids
- $sql = "SELECT packageID
- FROM wcf".WCF_N."_application
- WHERE groupID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($row['groupID']));
- while ($row = $statement->fetchArray()) {
- $insertStatement->execute(array(
- $packageID,
- $row['packageID'],
- 1
- ));
- }
- }
- }
-
/**
* Writes the config.inc.php for an application.
*
public static function writeConfigFile($packageID) {
$package = new Package($packageID);
$packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$package->packageDir));
- $file = new File($packageDir.\wcf\system\package\PackageInstallationDispatcher::CONFIG_FILE);
+ $file = new File($packageDir.PackageInstallationDispatcher::CONFIG_FILE);
$file->write("<?php\n");
- $currentPrefix = strtoupper(Package::getAbbreviation($package->package));
+ $prefix = strtoupper(Package::getAbbreviation($package->package));
- // get dependencies (only applications)
- $sql = "SELECT package.*, CASE WHEN package.packageID = ? THEN 1 ELSE 0 END AS sortOrder
- 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 = ?
- AND package.isApplication = 1
- AND package.packageDir <> ''
- ORDER BY sortOrder DESC,
- package_dependency.priority DESC";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
- $packageID,
- $packageID
- ));
- while ($row = $statement->fetchArray()) {
- $dependency = new Package(null, $row);
- $dependencyDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR.$dependency->packageDir));
- $prefix = strtoupper(Package::getAbbreviation($dependency->package));
-
- $file->write("// ".$dependency->package." (packageID ".$dependency->packageID.")\n");
- $file->write("if (!defined('".$prefix."_DIR')) define('".$prefix."_DIR', ".($dependency->packageID == $package->packageID ? "dirname(__FILE__).'/'" : "'".$dependencyDir."'").");\n");
- $file->write("if (!defined('RELATIVE_".$prefix."_DIR')) define('RELATIVE_".$prefix."_DIR', ".($dependency->packageID == $package->packageID ? "''" : "RELATIVE_".$currentPrefix."_DIR.'".FileUtil::getRelativePath($packageDir, $dependencyDir)."'").");\n");
- $file->write("if (!defined('".$prefix."_N')) define('".$prefix."_N', '".WCF_N."_".$dependency->instanceNo."');\n");
- $file->write("\n");
- }
+ $file->write("// ".$package->package." (packageID ".$package->packageID.")\n");
+ $file->write("if (!defined('".$prefix."_DIR')) define('".$prefix."_DIR', dirname(__FILE__).'/');\n");
+ $file->write("if (!defined('RELATIVE_".$prefix."_DIR')) define('RELATIVE_".$prefix."_DIR', '');\n");
+ $file->write("if (!defined('".$prefix."_N')) define('".$prefix."_N', '".WCF_N."_".$package->instanceNo."');\n");
+ $file->write("\n");
// get primary application
- $sql = "SELECT applications.packageID
- FROM wcf".WCF_N."_application application,
- wcf".WCF_N."_application applications
- WHERE application.packageID = ?
- AND applications.groupID = application.groupID
- AND applications.groupID IS NOT NULL
- AND applications.isPrimary = ?";
+ $sql = "SELECT packageID
+ FROM wcf".WCF_N."_application
+ WHERE applications.isPrimary = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID, 1));
+ $statement->execute(array(1));
$row = $statement->fetchArray();
- $packageID = ($row === false) ? $packageID : $row['packageID'];
// write general information
$file->write("// general info\n");
- $file->write("if (!defined('RELATIVE_WCF_DIR')) define('RELATIVE_WCF_DIR', RELATIVE_".$currentPrefix."_DIR.'".FileUtil::getRelativePath($packageDir, WCF_DIR)."');\n");
- $file->write("if (!defined('PACKAGE_ID')) define('PACKAGE_ID', ".$packageID.");\n");
+ $file->write("if (!defined('RELATIVE_WCF_DIR')) define('RELATIVE_WCF_DIR', RELATIVE_".$prefix."_DIR.'".FileUtil::getRelativePath($packageDir, WCF_DIR)."');\n");
+ $file->write("if (!defined('PACKAGE_ID')) define('PACKAGE_ID', ".$row['packageID'].");\n");
$file->write("if (!defined('PACKAGE_NAME')) define('PACKAGE_NAME', '".str_replace("'", "\'", $package->getName())."');\n");
$file->write("if (!defined('PACKAGE_VERSION')) define('PACKAGE_VERSION', '".$package->packageVersion."');\n");
$file->close();
}
- /**
- * Searches all dependent packages for the given package id
- * and rebuild their package dependencies list.
- *
- * @param integer $packageID
- */
- public static function rebuildParentPackageDependencies($packageID) {
- $sql = "SELECT packageID, MAX(priority) AS maxPriority
- FROM wcf".WCF_N."_package_dependency
- WHERE packageID IN (
- SELECT packageID
- FROM wcf".WCF_N."_package_dependency
- WHERE dependency = ?
- AND packageID <> ?
- UNION
- SELECT parentPackageID
- FROM wcf".WCF_N."_package
- WHERE packageID = ?
- )
- GROUP BY packageID
- ORDER BY maxPriority ASC, packageID DESC";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
- $packageID,
- $packageID,
- $packageID
- ));
- while ($row = $statement->fetchArray()) {
- self::rebuildPackageDependencies($row['packageID']);
- }
- }
-
/**
* Returns a list of plugins for currently active application.
*
- * @todo Care about plugins within dependencies, but are simple plugins just providing some crap.
+ * @todo Care about simple plugins just providing some crap.
* @return wcf\data\package\PackageList
*/
public static function getPluginList() {
$pluginList = new PackageList();
- $pluginList->getConditionBuilder()->add("package.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$pluginList->getConditionBuilder()->add("package.isApplication = ?", array(0));
return $pluginList;
class PackageCache extends SingletonFactory {
/**
* list of cached packages
- * @var array<wcf\data\package\Package>
+ * @var array<array>
*/
protected $packages = array();
* @return wcf\data\package\Package
*/
public function getPackage($packageID) {
- if (isset($this->packages[$packageID])) return $this->packages[$packageID];
+ if (isset($this->packages['packages'][$packageID])) {
+ return $this->packages['packages'][$packageID];
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the id of a specific package or 'null' if not found.
+ *
+ * @param string $package
+ * @return string
+ */
+ public function getPackageID($package) {
+ if (isset($this->packages['packageIDs'][$package])) {
+ return $this->packages['packageIDs'][$package];
+ }
return null;
}
use wcf\data\DatabaseObjectEditor;
use wcf\data\IEditableCachedObject;
use wcf\system\cache\CacheHandler;
-use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\WCF;
/**
* @see wcf\data\IEditableObject::delete()
*/
public function delete() {
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("showOrder >= ?", array($this->showOrder));
- $conditions->add("menuPosition = ?", array($this->menuPosition));
-
// update show order
$sql = "UPDATE wcf".WCF_N."_page_menu_item
SET showOrder = showOrder - 1
- ".$conditions;
+ WHERE showOrder >= ?
+ AND menuPosition = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
+ $statement->execute(array(
+ $this->showOrder,
+ $this->menuPosition
+ ));
parent::delete();
}
+ /**
+ * Sets current page menu item as landing page.
+ */
+ public function setAsLandingPage() {
+ $sql = "UPDATE wcf".WCF_N."_page_menu_item
+ SET isLandingPage = 0";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute();
+
+ $this->update(array('isLandingPage' => 1));
+ }
+
/**
* Updates the positions of a page menu item directly.
*
* @param integer $showOrder
*/
public static function setShowOrder($menuItemID, $menuPosition = 'header', $showOrder = 1) {
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("menuItemID = ?", array($menuItemID));
-
- // update show order
+ // Update
$sql = "UPDATE wcf".WCF_N."_page_menu_item
SET showOrder = ?,
menuPosition = ?
- ".$conditions;
+ WHERE menuItemID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
-
- $parameters = array_merge(array(
+ $statement->execute(array(
$showOrder,
- $menuPosition
- ), $conditions->getParameters());
- $statement->execute($parameters);
- }
-
- /**
- * Sets current page menu item as landing page.
- */
- public function setAsLandingPage() {
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
-
- $sql = "UPDATE wcf".WCF_N."_page_menu_item
- SET isLandingPage = 0
- ".$conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
-
- $this->update(array('isLandingPage' => 1));
+ $menuPosition,
+ $menuItemID
+ ));
}
/**
protected function updateShowOrder($showOrder, $menuPosition) {
if ($menuPosition == $this->menuPosition) {
if ($this->showOrder != $showOrder) {
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("showOrder <= ?", array($showOrder));
- $conditions->add("showOrder > ?", array($this->showOrder));
- $conditions->add("menuPosition = ?", array($menuPosition));
-
if ($showOrder < $this->showOrder) {
$sql = "UPDATE wcf".WCF_N."_page_menu_item
SET showOrder = showOrder + 1
- ".$conditions;
+ WHERE showOrder >= ?
+ AND showOrder < ?
+ AND menuPosition = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
+ $statement->execute(array(
+ $showOrder,
+ $this->showOrder,
+ $menuPosition
+ ));
}
else if ($showOrder > $this->showOrder) {
$sql = "UPDATE wcf".WCF_N."_page_menu_item
AND showOrder > ?
AND menuPosition = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
+ $statement->execute(array(
+ $showOrder,
+ $this->showOrder,
+ $menuPosition
+ ));
}
}
}
else {
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("showOrder >= ?", array($this->showOrder));
- $conditions->add("menuPosition = ?", array($this->menuPosition));
-
$sql = "UPDATE wcf".WCF_N."_page_menu_item
SET showOrder = showOrder - 1
- ".$conditions;
+ WHERE showOrder >= ?
+ AND menuPosition = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
-
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("showOrder >= ?", array($showOrder));
- $conditions->add("menuPosition = ?", array($menuPosition));
-
+ $statement->execute(array(
+ $this->showOrder,
+ $this->menuPosition
+ ));
+
$sql = "UPDATE wcf".WCF_N."_page_menu_item
SET showOrder = showOrder + 1
- ".$conditions;
+ WHERE showOrder >= ?
+ AND menuPosition = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
+ $statement->execute(array(
+ $showOrder,
+ $menuPosition
+ ));
}
}
*/
protected static function getShowOrder($showOrder, $menuPosition) {
if ($showOrder == 0) {
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("menuPosition = ?", array($menuPosition));
-
// get next number in row
$sql = "SELECT MAX(showOrder) AS showOrder
FROM wcf".WCF_N."_page_menu_item
- ".$conditions;
+ WHERE menuPosition = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
+ $statement->execute(array($menuPosition));
$row = $statement->fetchArray();
if (!empty($row)) $showOrder = intval($row['showOrder']) + 1;
else $showOrder = 1;
}
else {
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- $conditions->add("showOrder >= ?", array($showOrder));
- $conditions->add("menuPosition = ?", array($menuPosition));
-
$sql = "UPDATE wcf".WCF_N."_page_menu_item
SET showOrder = showOrder + 1
- ".$conditions;
+ WHERE showOrder >= ?
+ AND menuPosition = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
+ $statement->execute(array(
+ $showOrder,
+ $menuPosition
+ ));
}
return $showOrder;
* @see wcf\data\IEditableCachedObject::resetCache()
*/
public static function resetCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.pageMenu-*.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.pageMenu.php');
}
}
parent::__construct($object);
// load icon cache
- $cacheName = 'icon-'.PACKAGE_ID.'-'.$this->styleID;
+ $cacheName = 'icon-'.$this->styleID;
CacheHandler::getInstance()->addResource(
$cacheName,
WCF_DIR.'cache/cache.'.$cacheName.'.php',
* @see wcf\data\IEditableCachedObject::resetCache()
*/
public static function resetCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.styles.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.style.php');
}
/**
// get available template ids
$results = array();
$availableTemplateIDs = array();
- $sql = "SELECT template.templateName, template.templateID, template.templateGroupID, template.packageID
- FROM wcf".WCF_N."_template template
- LEFT JOIN wcf".WCF_N."_package_dependency package_dependency
- ON (package_dependency.dependency = template.packageID)
- WHERE package_dependency.packageID = ?
- ".($replace !== null ? "AND template.templateGroupID <> 0" : "")."
- ORDER BY package_dependency.priority ASC";
+ $sql = "SELECT templateName, templateID, templateGroupID, packageID
+ FROM wcf".WCF_N."_template
+ ".($replace !== null ? "WHERE templateGroupID <> 0" : "");
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(PACKAGE_ID));
+ $statement->execute();
while ($row = $statement->fetchArray()) {
if (!isset($availableTemplateIDs[$row['templateName'].'-'.$row['templateGroupID']]) || PACKAGE_ID == $row['packageID']) {
$availableTemplateIDs[$row['templateName'].'-'.$row['templateGroupID']] = $row['templateID'];
* Gets all user options from cache.
*/
protected static function getUserOptionCache() {
- $cacheName = 'user-option-'.PACKAGE_ID;
CacheHandler::getInstance()->addResource(
- $cacheName,
- WCF_DIR.'cache/cache.'.$cacheName.'.php',
+ 'userOption',
+ WCF_DIR.'cache/cache.userOption.php',
'wcf\system\cache\builder\OptionCacheBuilder'
);
- self::$userOptions = CacheHandler::getInstance()->get($cacheName, 'options');
+ self::$userOptions = CacheHandler::getInstance()->get('userOption', 'options');
}
/**
protected static function getCache() {
if (self::$cache === null) {
CacheHandler::getInstance()->addResource(
- 'usergroups',
- WCF_DIR.'cache/cache.userGroups.php',
+ 'userGroup',
+ WCF_DIR.'cache/cache.userGroup.php',
'wcf\system\cache\builder\UserGroupCacheBuilder'
);
- self::$cache = CacheHandler::getInstance()->get('usergroups');
+ self::$cache = CacheHandler::getInstance()->get('userGroup');
}
}
if ($this->groupOptions === null) {
// get all options and filter options with low priority
$this->groupOptions = $groupOptionIDs = array();
- $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";
+ $sql = "SELECT optionName, optionID
+ FROM wcf".WCF_N."_user_group_option";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(PACKAGE_ID));
+ $statement->execute();
while ($row = $statement->fetchArray()) {
$groupOptionIDs[$row['optionName']] = $row['optionID'];
*/
public static function resetCache() {
// clear cache
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.userGroups*.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.userGroup.php');
// clear sessions
SessionHandler::resetSessions();
*/
protected static $coreObjectCache = array();
- /**
- * list of ids of dependent packages
- * @var array<integer>
- */
- protected static $packageDependencies = array();
-
/**
* database object
* @var wcf\system\database\Database
*/
protected function loadDefaultCacheResources() {
CacheHandler::getInstance()->addResource(
- 'languages',
- WCF_DIR.'cache/cache.languages.php',
+ 'language',
+ WCF_DIR.'cache/cache.language.php',
'wcf\system\cache\builder\LanguageCacheBuilder'
);
CacheHandler::getInstance()->addResource(
- 'spiders',
- WCF_DIR.'cache/cache.spiders.php',
+ 'spider',
+ WCF_DIR.'cache/cache.spider.php',
'wcf\system\cache\builder\SpiderCacheBuilder'
);
if (defined('PACKAGE_ID')) {
CacheHandler::getInstance()->addResource(
- 'coreObjects-'.PACKAGE_ID,
- WCF_DIR.'cache/cache.coreObjects-'.PACKAGE_ID.'.php',
+ 'coreObject',
+ WCF_DIR.'cache/cache.coreObject.php',
'wcf\system\cache\builder\CoreObjectCacheBuilder'
);
}
return;
}
- self::$coreObjectCache = CacheHandler::getInstance()->get('coreObjects-'.PACKAGE_ID);
- self::$packageDependencies = \wcf\system\package\PackageDependencyHandler::getInstance()->getDependencies();
+ self::$coreObjectCache = CacheHandler::getInstance()->get('coreObject');
}
/**
* @return string
*/
protected static final function getCoreObject($className) {
- foreach (self::$packageDependencies as $packageID) {
- if (isset(self::$coreObjectCache[$packageID][$className])) {
- return self::$coreObjectCache[$packageID][$className];
- }
+ if (isset(self::$coreObjectCache[$className])) {
+ return self::$coreObjectCache[$className];
}
return null;
parent::loadDefaultCacheResources();
CacheHandler::getInstance()->addResource(
- 'packages',
- WCF_DIR.'cache/cache.packages.php',
+ 'package',
+ WCF_DIR.'cache/cache.package.php',
'wcf\system\cache\builder\PackageCacheBuilder'
);
}
$packageID = self::getWcfPackageID();
define('PACKAGE_ID', $packageID);
}
-
- /* todo
- $packageID = 0;
- $packages = CacheHandler::getInstance()->get('packages');
- if (isset($_REQUEST['packageID'])) $packageID = intval($_REQUEST['packageID']);
-
- if (!isset($packages[$packageID]) || !$packages[$packageID]['isApplication']) {
- // package id is invalid
- $packageID = self::getWcfPackageID();
- }
-
- // define active package id
- if (!defined('PACKAGE_ID')) define('PACKAGE_ID', $packageID);*/
}
/**
*/
protected function getQuickAccessPackages() {
$quickAccessPackages = array();
- $packages = CacheHandler::getInstance()->get('packages');
+ $packages = CacheHandler::getInstance()->get('package');
foreach ($packages as $packageID => $package) {
if (!$package->isApplication) break;
if ($package->package != 'com.woltlab.wcf') {
}
// rebuild language cache
- CacheHandler::getInstance()->clearResource('languages');
+ CacheHandler::getInstance()->clearResource('language');
// go to next step
$this->gotoNextStep('createUser');
<?php
namespace wcf\system\application;
+use wcf\data\application\ApplicationAction;
+use wcf\data\application\ApplicationList;
use wcf\system\cache\CacheHandler;
use wcf\system\SingletonFactory;
use wcf\util\StringUtil;
* Initializes cache.
*/
protected function init() {
- $cacheName = 'application-'.PACKAGE_ID;
CacheHandler::getInstance()->addResource(
- $cacheName,
- WCF_DIR.'cache/cache.'.$cacheName.'.php',
+ 'application',
+ WCF_DIR.'cache/cache.application.php',
'wcf\system\cache\builder\ApplicationCacheBuilder'
);
- $this->cache = CacheHandler::getInstance()->get($cacheName);
+ $this->cache = CacheHandler::getInstance()->get('application');
}
/**
return false;
}
+
+ /**
+ * Rebuilds cookie domain/path for all applications.
+ */
+ public static function rebuild() {
+ $applicationList = new ApplicationList();
+ $applicationList->sqlLimit = 0;
+ $applicationList->readObjects();
+
+ $applicationAction = new ApplicationAction($applicationList->getObjects(), 'rebuild');
+ $applicationAction->executeAction();
+ }
}
/**
* @see wcf\system\cache\ICacheBuilder::getData()
*/
- public function getData(array $cacheResource) {
- list($cache, $packageID) = explode('-', $cacheResource['cache']);
+ public function getData(array $cacheResource) {
$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";
+ FROM wcf".WCF_N."_acp_menu_item menu_item";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute();
$itemIDs = array();
while ($row = $statement->fetchArray()) {
$itemIDs[$row['menuItem']] = $row['menuItemID'];
}
// get top option categories
- $optionCategories = $this->getTopOptionCategories($packageID);
+ $optionCategories = $this->getTopOptionCategories();
if (!empty($optionCategories)) {
if (!isset($data['wcf.acp.menu.link.option.category'])) {
$data['wcf.acp.menu.link.option.category'] = array();
return $data;
}
- protected function getTopOptionCategories($packageID) {
- // get all option categories and filter categories with low priority
+ protected function getTopOptionCategories() {
+ // get all option categories
$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";
+ FROM wcf".WCF_N."_option_category";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute();
$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 = ?
- )
+ SELECT COUNT(*) FROM wcf".WCF_N."_option WHERE categoryName = category.categoryName
) AS count
FROM wcf".WCF_N."_option_category category
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($statementParameters);
+ $statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
if (!isset($this->optionCategoryStructure[$row['parentCategoryName']])) $this->optionCategoryStructure[$row['parentCategoryName']] = array();
$this->optionCategoryStructure[$row['parentCategoryName']][] = $row;
<?php
namespace wcf\system\cache\builder;
use wcf\data\acp\search\provider\ACPSearchProviderList;
-use wcf\system\package\PackageDependencyHandler;
/**
* Caches the ACP search providers.
*/
public function getData(array $cacheResource) {
$providerList = new ACPSearchProviderList();
- $providerList->getConditionBuilder()->add("acp_search_provider.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$providerList->sqlLimit = 0;
$providerList->sqlOrderBy = "acp_search_provider.showOrder ASC";
$providerList->readObjects();
<?php
namespace wcf\system\cache\builder;
use wcf\data\category\CategoryList;
-use wcf\system\package\PackageDependencyHandler;
/**
* Caches the categories for a certain package.
$list = new CategoryList();
$list->sqlLimit = 0;
$list->sqlSelects = "object_type.objectType";
- $list->sqlJoins = " LEFT JOIN wcf".WCF_N."_object_type object_type
- ON (object_type.objectTypeID = category.objectTypeID)";
- $list->getConditionBuilder()->add("object_type.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
+ $list->sqlJoins = "LEFT JOIN wcf".WCF_N."_object_type object_type ON (object_type.objectTypeID = category.objectTypeID)";
$list->sqlOrderBy = "category.showOrder ASC";
$list->readObjects();
* @see wcf\system\cache\ICacheBuilder::getData()
*/
public function getData(array $cacheResource) {
- list($cache, $packageID) = explode('-', $cacheResource['cache']);
$data = array(
'adapters' => array(),
'objectTypes' => 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";
+ ON (package.packageID = listener.packageID)";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute();
while ($row = $statement->fetchArray()) {
if (!is_array($data['adapters'][$row['objectType']])) $data['adapters'][$row['objectType']] = array();
$data['adapters'][$row['objectType']][] = $row;
<?php
namespace wcf\system\cache\builder;
use wcf\data\clipboard\action\ClipboardActionList;
-use wcf\system\package\PackageDependencyHandler;
/**
* Caches clipboard actions.
*/
public function getData(array $cacheResource) {
$actionList = new ClipboardActionList();
- $actionList->getConditionBuilder()->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$actionList->sqlLimit = 0;
$actionList->readObjects();
<?php
namespace wcf\system\cache\builder;
-use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\WCF;
/**
* @see wcf\system\cache\ICacheBuilder::getData()
*/
public function getData(array $cacheResource) {
- $conditions = new PreparedStatementConditionBuilder();
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
-
$sql = "SELECT pageClassName, actionID
- FROM wcf".WCF_N."_clipboard_page
- ".$conditions;
+ FROM wcf".WCF_N."_clipboard_page";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
+ $statement->execute();
$data = array();
while ($row = $statement->fetchArray()) {
<?php
namespace wcf\system\cache\builder;
use wcf\data\core\object\CoreObjectList;
-use wcf\system\package\PackageDependencyHandler;
/**
* Caches the core objects.
* @see wcf\system\cache\ICacheBuilder::getData()
*/
public function getData(array $cacheResource) {
- list($cache, $packageID) = explode('-', $cacheResource['cache']);
$data = array();
$coreObjectList = new CoreObjectList();
- $coreObjectList->getConditionBuilder()->add("core_object.packageID IN (?)", array(PackageDependencyHandler::getInstance()->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;
+ $data[$className] = $coreObject->objectName;
}
return $data;
<?php
namespace wcf\system\cache\builder;
-use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\WCF;
/**
* @see wcf\system\cache\ICacheBuilder::getData()
*/
public function getData(array $cacheResource) {
- // get next execution time
- $conditionBuilder = new PreparedStatementConditionBuilder();
- $conditionBuilder->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
-
$sql = "SELECT MIN(nextExec) AS nextExec,
MIN(afterNextExec) AS afterNextExec
- FROM wcf".WCF_N."_cronjob
- ".$conditionBuilder->__toString();
+ FROM wcf".WCF_N."_cronjob";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditionBuilder->getParameters());
+ $statement->execute();
$row = $statement->fetchArray();
return array(
* @see wcf\system\cache\ICacheBuilder::getData()
*/
public function getData(array $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";
+ $sql = "SELECT event_listener.*
+ FROM wcf".WCF_N."_event_listener event_listener";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute();
while ($row = $statement->fetchArray()) {
// distinguish between inherited actions and non-inherited actions
if (!$row['inherit']) {
<?php
namespace wcf\system\cache\builder;
use wcf\data\package\Package;
-use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\WCF;
use wcf\util\FileUtil;
// get package dirs
$packageDirs = array();
- $conditionBuilder = new PreparedStatementConditionBuilder();
- $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
- ON (package.packageID = dependency.dependency)
- ".$conditionBuilder->__toString()."
- ORDER BY dependency.priority DESC";
+ $sql = "SELECT packageDir
+ FROM wcf".WCF_N."_package package
+ WHERE isApplication = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditionBuilder->getParameters());
+ $statement->execute(array(1));
while ($row = $statement->fetchArray()) {
$packageDirs[] = FileUtil::getRealPath(WCF_DIR.$row['packageDir']);
}
);
// get definitions
- $sql = "SELECT object_type_definition.*
- FROM wcf".WCF_N."_package_dependency package_dependency,
- wcf".WCF_N."_object_type_definition object_type_definition
- WHERE object_type_definition.packageID = package_dependency.dependency
- AND package_dependency.packageID = ?
- ORDER BY package_dependency.priority";
+ $sql = "SELECT *
+ FROM wcf".WCF_N."_object_type_definition";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute();
while ($row = $statement->fetchArray()) {
$data['definitions'][$row['definitionID']] = new ObjectTypeDefinition(null, $row);
}
// get object types
- $sql = "SELECT object_type.*
- FROM wcf".WCF_N."_package_dependency package_dependency,
- wcf".WCF_N."_object_type object_type
- WHERE object_type.packageID = package_dependency.dependency
- AND package_dependency.packageID = ?
- ORDER BY package_dependency.priority";
+ $sql = "SELECT *
+ FROM wcf".WCF_N."_object_type object_type";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($packageID));
while ($row = $statement->fetchArray()) {
if (count($information) == 3) {
$type = $information[0];
- $packageID = $information[2];
preg_match_all('~((?:^|[A-Z])[a-z]+)~', $information[0], $matches);
if (isset($matches[1])) {
}
else {
$type = '';
- $packageID = $information[1];
}
$data = array(
// option categories
// get all option categories and sort categories by priority
- $sql = "SELECT categoryName, categoryID
- FROM wcf".WCF_N."_".$tableName."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";
+ $sql = "SELECT categoryName, categoryID
+ FROM wcf".WCF_N."_".$tableName."option_category";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute();
$optionCategories = array();
while ($row = $statement->fetchArray()) {
$optionCategories[$row['categoryName']] = $row['categoryID'];
// get all options and sort options by priority
$optionIDs = array();
$sql = "SELECT optionName, optionID
- FROM wcf".WCF_N."_".$tableName."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";
+ FROM wcf".WCF_N."_".$tableName."option";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute();
while ($row = $statement->fetchArray()) {
$optionIDs[$row['optionName']] = $row['optionID'];
}
* @see wcf\system\cache\ICacheBuilder::getData()
*/
public function getData(array $cacheResource) {
+ $data = array(
+ 'packages' => array(),
+ 'packageIDs' => array()
+ );
+
$packageList = new PackageList();
$packageList->sqlLimit = 0;
$packageList->readObjects();
- return $packageList->getObjects();
+ foreach ($packageList as $package) {
+ $data['packages'][$package->packageID] = $package;
+ $data['packageIDs'][$package->package] = $package->packageID;
+ }
+
+ return $data;
}
}
+++ /dev/null
-<?php
-namespace wcf\system\cache\builder;
-use wcf\system\WCF;
-
-/**
- * Caches the dependencies of a package.
- *
- * @author Marcel Werk
- * @copyright 2001-2012 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage system.cache.builder
- * @category Community Framework
- */
-class PackageDependencyCacheBuilder implements ICacheBuilder {
- /**
- * @see wcf\system\cache\ICacheBuilder::getData()
- */
- public function getData(array $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;
- }
-}
/**
* @see wcf\system\cache\ICacheBuilder::getData()
*/
- public function getData(array $cacheResource) {
- list($cache, $packageID) = explode('-', $cacheResource['cache']);
+ public function getData(array $cacheResource) {
$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";
+ $sql = "SELECT menuItem, menuItemID
+ FROM wcf".WCF_N."_page_menu_item";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute();
$itemIDs = array();
while ($row = $statement->fetchArray()) {
$itemIDs[$row['menuItem']] = $row['menuItemID'];
<?php
namespace wcf\system\cache\builder;
use wcf\data\sitemap\SitemapList;
-use wcf\system\package\PackageDependencyHandler;
/**
* Caches sitemap structure.
*/
public function getData(array $cacheResource) {
$sitemapList = new SitemapList();
- $sitemapList->getConditionBuilder()->add("sitemap.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$sitemapList->sqlLimit = 0;
$sitemapList->sqlOrderBy = "sitemap.showOrder ASC";
$sitemapList->readObjects();
$information = explode('-', $cacheResource['cache']);
if (count($information) == 3) {
$prefix = $information[0].'_';
- $packageID = $information[2];
}
else {
$prefix = '';
- $packageID = $information[1];
}
$data = array();
// 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";
+ FROM wcf".WCF_N."_".$prefix."template";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute();
while ($row = $statement->fetchArray()) {
- if (!isset($data[$row['templateName']]) || $packageID == $row['packageID']) {
+ if (!isset($data[$row['templateName']])) {
$data[$row['templateName']] = $row['packageID'];
}
}
<?php
namespace wcf\system\cache\builder;
use wcf\data\template\listener\TemplateListenerList;
-use wcf\system\package\PackageDependencyHandler;
/**
* Caches template listener information.
// 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::getInstance()->getDependencies()));
$templateListenerList->sqlLimit = 0;
$templateListenerList->readObjects();
<?php
namespace wcf\system\cache\builder;
use wcf\data\template\listener\TemplateListenerList;
-use wcf\system\package\PackageDependencyHandler;
/**
* Caches template listener code.
$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::getInstance()->getDependencies()));
$templateListenerList->sqlLimit = 0;
$templateListenerList->readObjects();
$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";
+ $sql = "SELECT optionName, optionID
+ FROM wcf".WCF_N."_user_group_option";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($packageID));
+ $statement->execute();
}
$options = array();
* @see wcf\system\cache\source\ICacheSource::flush()
*/
public function flush() {
- $sql = "SELECT package.packageDir
- 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 = ?
- AND isApplication = ?";
+ $sql = "SELECT packageDir
+ FROM wcf".WCF_N."_package
+ WHERE isApplication = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
- PACKAGE_ID,
- 1
- ));
+ $statement->execute(array(1));
while ($row = $statement->fetchArray()) {
$packageDir = FileUtil::getRealPath(WCF_DIR.$row['packageDir']);
$cacheDir = $packageDir.'cache';
$this->objectTypeIDs[$objectType->objectTypeID] = $objectType->objectType;
}
- $cacheName = 'category-'.PACKAGE_ID;
CacheHandler::getInstance()->addResource(
- $cacheName,
- WCF_DIR.'cache/cache.'.$cacheName.'.php',
+ 'category',
+ WCF_DIR.'cache/cache.category.php',
'wcf\system\cache\builder\CategoryCacheBuilder'
);
- $this->categories = CacheHandler::getInstance()->get($cacheName, 'categories');
- $this->objectTypeCategoryIDs = CacheHandler::getInstance()->get($cacheName, 'objectTypeCategoryIDs');
+ $this->categories = CacheHandler::getInstance()->get('category', 'categories');
+ $this->objectTypeCategoryIDs = CacheHandler::getInstance()->get('category', 'objectTypeCategoryIDs');
}
/**
* Reloads the category cache.
*/
public function reloadCache() {
- CacheHandler::getInstance()->clearResource('category-'.PACKAGE_ID);
+ CacheHandler::getInstance()->clearResource('category');
$this->init();
}
* Loads cleanup adapter cache.
*/
protected function loadCache() {
- $cacheName = 'cleanupAdapter-'.PACKAGE_ID;
CacheHandler::getInstance()->addResource(
- $cacheName,
- WCF_DIR.'cache/cache.'.$cacheName.'.php',
+ 'cleanupAdapter',
+ WCF_DIR.'cache/cache.cleanupAdapter.php',
'wcf\system\cache\builder\CleanupAdapterCacheBuilder'
);
-
- $this->cache = CacheHandler::getInstance()->get($cacheName);
+ $this->cache = CacheHandler::getInstance()->get('cleanupAdapter');
}
/**
}
CacheHandler::getInstance()->addResource(
- 'clipboard-page-'.PACKAGE_ID,
- WCF_DIR.'cache/cache.clipboard-page-'.PACKAGE_ID.'.php',
+ 'clipboardPage',
+ WCF_DIR.'cache/cache.clipboardPage.php',
'wcf\system\cache\builder\ClipboardPageCacheBuilder'
);
- $this->pageCache = CacheHandler::getInstance()->get('clipboard-page-'.PACKAGE_ID);
+ $this->pageCache = CacheHandler::getInstance()->get('clipboardPage');
}
/**
if ($this->actionCache !== null) return;
CacheHandler::getInstance()->addResource(
- 'clipboard-action-'.PACKAGE_ID,
- WCF_DIR.'cache/cache.clipboard-action-'.PACKAGE_ID.'.php',
+ 'clipboardAction',
+ WCF_DIR.'cache/cache.clipboardAction.php',
'wcf\system\cache\builder\ClipboardActionCacheBuilder'
);
- $this->actionCache = CacheHandler::getInstance()->get('clipboard-action-'.PACKAGE_ID);
+ $this->actionCache = CacheHandler::getInstance()->get('clipboardAction');
}
/**
use wcf\data\cronjob\Cronjob;
use wcf\data\cronjob\CronjobEditor;
use wcf\system\cache\CacheHandler;
-use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\exception\SystemException;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\SingletonFactory;
use wcf\system\WCF;
use wcf\util\ClassUtil;
* Loads outstanding cronjobs.
*/
protected function loadCronjobs() {
- $conditions = new PreparedStatementConditionBuilder();
- $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));
- $conditions->add("cronjob.state = ?", array(Cronjob::READY));
-
- $sql = "SELECT cronjob.*
- FROM wcf".WCF_N."_cronjob cronjob
- ".$conditions;
+ $sql = "SELECT *
+ FROM wcf".WCF_N."_cronjob
+ WHERE (cronjob.nextExec <= ? OR cronjob.afterNextExec <= ?)
+ AND cronjob.active = ?
+ AND cronjob.failCount < ?
+ AND cronjob.state = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute($conditions->getParameters());
+ $statement->execute(array(
+ TIME_NOW,
+ TIME_NOW,
+ 1,
+ Cronjob::MAX_FAIL_COUNT,
+ Cronjob::READY
+ ));
while ($row = $statement->fetchArray()) {
$cronjob = new Cronjob(null, $row);
$cronjobEditor = new CronjobEditor($cronjob);
* Loads the cached data for cronjob execution.
*/
protected function loadCache() {
- $cacheName = 'cronjobs-'.PACKAGE_ID;
CacheHandler::getInstance()->addResource(
- $cacheName,
- WCF_DIR.'cache/cache.'.$cacheName.'.php',
+ 'cronjob',
+ WCF_DIR.'cache/cache.cronjob.php',
'wcf\system\cache\builder\CronjobCacheBuilder'
);
- $this->cache = CacheHandler::getInstance()->get($cacheName);
+ $this->cache = CacheHandler::getInstance()->get('cronjob');
}
/**
* Clears the cronjob data cache.
*/
public static function clearCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.cronjobs-'.PACKAGE_ID.'.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.cronjob.php');
}
}
}
// clear spider cache
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.spiders.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.spider.php');
}
// delete tmp file
*/
protected function loadActions() {
$environment = (class_exists('wcf\system\WCFACP', false) ? 'admin' : 'user');
- $cacheName = 'eventListener-'.PACKAGE_ID;
CacheHandler::getInstance()->addResource(
- $cacheName,
- WCF_DIR.'cache/cache.'.$cacheName.'.php',
+ 'eventListener',
+ WCF_DIR.'cache/cache.eventListener.php',
'wcf\system\cache\builder\EventListenerCacheBuilder'
);
- $cache = CacheHandler::getInstance()->get($cacheName);
+ $cache = CacheHandler::getInstance()->get('eventListener');
if (isset($cache['actions'][$environment])) {
$this->actions = $cache['actions'][$environment];
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\exception\SystemException;
use wcf\system\language\LanguageFactory;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\Regex;
use wcf\system\SingletonFactory;
use wcf\system\WCF;
$conditions->add("languageID IN (?)", array($languageIDs));
$conditions->add("languageItem = ?", array($languageVariable));
- if (isset($this->elementOptions[$elementID]) && !Regex::compile('^'.$this->elementOptions[$elementID]['pattern'].'$')->match($languageVariable) && $this->isLanguageVariable($languageVariable)) {
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
- }
- else {
- $conditions->add("packageID = ?", array($packageID));
- }
-
$sql = "SELECT languageItemID, languageID
FROM wcf".WCF_N."_language_item
".$conditions;
* Removes previously created i18n language variables.
*
* @param string $languageVariable
- * @param integer $packageID
*/
- public function remove($languageVariable, $packageID = PACKAGE_ID) {
+ public function remove($languageVariable) {
$sql = "DELETE FROM wcf".WCF_N."_language_item
- WHERE languageItem = ?
- AND packageID = ?";
+ WHERE languageItem = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
- $languageVariable,
- $packageID
- ));
+ $statement->execute(array($languageVariable));
// reset language cache
LanguageFactory::getInstance()->deleteLanguageCache();
// use i18n values from language items
$sql = "SELECT languageID, languageItemValue
FROM wcf".WCF_N."_language_item
- WHERE languageItem = ?
- AND packageID = ?";
+ WHERE languageItem = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array(
- $this->elementOptions[$elementID]['value'],
- $this->elementOptions[$elementID]['packageID']
+ $this->elementOptions[$elementID]['value']
));
while ($row = $statement->fetchArray()) {
$i18nValues[$row['languageID']] = StringUtil::encodeJS(StringUtil::unifyNewlines($row['languageItemValue']));
protected function loadCache() {
if (defined('WCF_N')) {
CacheHandler::getInstance()->addResource(
- 'languages',
- WCF_DIR.'cache/cache.languages.php',
+ 'language',
+ WCF_DIR.'cache/cache.language.php',
'wcf\system\cache\builder\LanguageCacheBuilder'
);
- $this->cache = CacheHandler::getInstance()->get('languages');
+ $this->cache = CacheHandler::getInstance()->get('language');
}
}
* Clears languages cache.
*/
public function clearCache() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.languages.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.language.php');
}
/**
return;
}
- $cacheName = 'acpMenu-'.PACKAGE_ID;
CacheHandler::getInstance()->addResource(
- $cacheName,
- WCF_DIR.'cache/cache.'.$cacheName.'.php',
+ 'acpMenu',
+ WCF_DIR.'cache/cache.acpMenu.php',
'wcf\system\cache\builder\ACPMenuCacheBuilder'
);
- $this->menuItems = CacheHandler::getInstance()->get($cacheName);
+ $this->menuItems = CacheHandler::getInstance()->get('acpMenu');
}
}
parent::loadCache();
// get cache
- $cacheName = 'pageMenu-'.PACKAGE_ID;
CacheHandler::getInstance()->addResource(
- $cacheName,
- WCF_DIR.'cache/cache.'.$cacheName.'.php',
+ 'pageMenu',
+ WCF_DIR.'cache/cache.pageMenu.php',
'wcf\system\cache\builder\PageMenuCacheBuilder'
);
- $this->menuItems = CacheHandler::getInstance()->get($cacheName);
+ $this->menuItems = CacheHandler::getInstance()->get('pageMenu');
}
/**
* @param boolean $loadActiveOptions
*/
protected function readCache($loadActiveOptions) {
- $cacheName = $this->cacheName . '-' . PACKAGE_ID;
- CacheHandler::getInstance()->addResource($cacheName, WCF_DIR.'cache/cache.'.$cacheName.'.php', $this->cacheClass);
+ CacheHandler::getInstance()->addResource(
+ $this->cacheName,
+ WCF_DIR.'cache/cache.'.$this->cacheName.'.php',
+ $this->cacheClass
+ );
// get cache contents
- $this->cachedCategories = CacheHandler::getInstance()->get($cacheName, 'categories');
- $this->cachedOptions = CacheHandler::getInstance()->get($cacheName, 'options');
- $this->cachedCategoryStructure = CacheHandler::getInstance()->get($cacheName, 'categoryStructure');
- $this->cachedOptionToCategories = CacheHandler::getInstance()->get($cacheName, 'optionToCategories');
+ $this->cachedCategories = CacheHandler::getInstance()->get($this->cacheName, 'categories');
+ $this->cachedOptions = CacheHandler::getInstance()->get($this->cacheName, 'options');
+ $this->cachedCategoryStructure = CacheHandler::getInstance()->get($this->cacheName, 'categoryStructure');
+ $this->cachedOptionToCategories = CacheHandler::getInstance()->get($this->cacheName, 'optionToCategories');
if ($loadActiveOptions) {
// get active options
* @return boolean
*/
public function isAlreadyInstalled() {
- $duplicates = $this->getDuplicates();
-
- // package is not installed
- if (empty($duplicates)) {
- return false;
- }
-
- $parentPackageIDs = array();
- foreach ($duplicates as $package) {
- // applications are always allowed
- if ($package['isApplication']) {
- return false;
- }
-
- // wcf packages must be unique
- if (!$package['parentPackageID']) {
- return true;
- }
-
- $parentPackageIDs[] = $package['parentPackageID'];
- }
-
- // determine if plugin is unique within current application
- $packageIDs = PackageDependencyHandler::getInstance()->getDependencies();
- foreach ($parentPackageIDs as $packageID) {
- if (in_array($packageID, $packageIDs)) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Returns a list of all installed instances of this package.
- *
- * @return array packages
- */
- public function getDuplicates() {
- $packages = array();
- $sql = "SELECT *
- FROM wcf".WCF_N."_package
- WHERE package = ?";
+ $sql = "SELECT COUNT(*) AS count
+ FROM wcf".WCF_N."_package
+ WHERE package = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute(array($this->packageInfo['name']));
- while ($row = $statement->fetchArray()) {
- $packages[$row['packageID']] = $row;
- }
+ $row = $statement->fetchArray();
- return $packages;
+ return ($row['count'] > 0) ? true : false;
}
/**
+++ /dev/null
-<?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-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
- */
-class PackageDependencyHandler extends SingletonFactory {
- /**
- * cache of package dependencies
- * @var array
- */
- 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 function getPackageID($package) {
- if (!defined('PACKAGE_ID')) {
- return null;
- }
-
- if (isset($this->packageDependencyCache['resolve'][$package])) {
- $packageID = $this->packageDependencyCache['resolve'][$package];
-
- if (is_array($packageID)) {
- $packageID = array_shift($packageID);
- }
-
- return $packageID;
- }
-
- return null;
- }
-
- /**
- * Returns the package ids of all dependent packages.
- *
- * @return array
- */
- public function getDependencies() {
- if (!defined('PACKAGE_ID')) {
- return null;
- }
-
- return $this->packageDependencyCache['dependency'];
- }
-}
use wcf\data\package\installation\queue\PackageInstallationQueueEditor;
use wcf\data\package\Package;
use wcf\data\package\PackageEditor;
+use wcf\system\application\ApplicationHandler;
use wcf\system\cache\CacheHandler;
use wcf\system\database\statement\PreparedStatement;
use wcf\system\database\util\PreparedStatementConditionBuilder;
if (!PACKAGE_ID) {
CacheHandler::getInstance()->clear(WCF_DIR.'cache/', 'cache.*.php');
}
+
+ // rebuild application paths
+ ApplicationHandler::rebuild();
}
}
*/
protected $knownTables = array();
- /**
- * list of package ids
- * @var array
- */
- protected $dependentPackageIDs = array();
/**
* list of conflicted database tables
// get logged tables
$this->getKnownTables();
-
- // get package ids of dependencies
- $this->getDependentPackageIDs();
// enable testing mode
$this->test = true;
}
}
- /**
- * Gets a list of dependent packages.
- */
- protected function getDependentPackageIDs() {
- $sql = "SELECT dependency
- FROM wcf".WCF_N."_package_dependency
- WHERE packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($this->package->packageID));
- while ($row = $statement->fetchArray()) {
- $this->dependentPackageIDs[] = $row['dependency'];
- }
- }
-
/**
* Returns the owner of a specific database table column.
*
protected function executeAddColumnStatement($tableName, $columnName, $columnData) {
if ($this->test) {
if (isset($this->knownTables[$tableName])) {
- if ($this->knownTables[$tableName] != $this->package->packageID && !in_array($this->knownTables[$tableName], $this->dependentPackageIDs)) {
- throw new SystemException("Can not add column '".$columnName."' to table '.$tableName.'. An installion can only 'ADD' things to tables from the same package environment.");
+ if ($this->knownTables[$tableName] != $this->package->packageID) {
+ throw new SystemException("Can not add column '".$columnName."' to table '.$tableName.'.");
}
}
}
protected function executeAddIndexStatement($tableName, $indexName, $indexData) {
if ($this->test) {
if (isset($this->knownTables[$tableName])) {
- if ($this->knownTables[$tableName] != $this->package->packageID && !in_array($this->knownTables[$tableName], $this->dependentPackageIDs)) {
- throw new SystemException("Can not add index '".$indexName."' to table '.$tableName.'. An installion can only 'ADD' things to tables from the same package environment.");
+ if ($this->knownTables[$tableName] != $this->package->packageID) {
+ throw new SystemException("Can not add index '".$indexName."' to table '.$tableName.'.");
}
}
}
protected function executeAddForeignKeyStatement($tableName, $indexName, $indexData) {
if ($this->test) {
if (isset($this->knownTables[$tableName])) {
- if ($this->knownTables[$tableName] != $this->package->packageID && !in_array($this->knownTables[$tableName], $this->dependentPackageIDs)) {
- throw new SystemException("Can not add foreign key '".$indexName."' to table '.$tableName.'. An installion can only 'ADD' things to tables from the same package environment.");
+ if ($this->knownTables[$tableName] != $this->package->packageID) {
+ throw new SystemException("Can not add foreign key '".$indexName."' to table '.$tableName.'.");
}
}
}
<?php
namespace wcf\system\package;
-use wcf\util\FileUtil;
-
use wcf\data\option\OptionEditor;
use wcf\data\package\installation\queue\PackageInstallationQueue;
use wcf\data\package\Package;
use wcf\data\package\PackageEditor;
use wcf\data\package\PackageList;
+use wcf\system\application\ApplicationHandler;
use wcf\system\cache\CacheHandler;
use wcf\system\exception\IllegalLinkException;
use wcf\system\exception\SystemException;
use wcf\system\request\LinkHandler;
use wcf\system\setup\Uninstaller;
use wcf\system\WCF;
+use wcf\util\FileUtil;
use wcf\util\HeaderUtil;
/**
CacheHandler::getInstance()->clear($dir.'cache/', 'cache.*.php');
}
}
+
+ // rebuild application paths
+ ApplicationHandler::rebuild();
}
// return next node
));
// reset package cache
- CacheHandler::getInstance()->clearResource('packages');
+ CacheHandler::getInstance()->clearResource('package');
// rebuild package dependencies
Package::rebuildParentPackageDependencies($this->queue->packageID);
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
*/
protected function cleanup() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.acpSearchProvider-*.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.acpSearchProvider.php');
}
}
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
*/
protected function cleanup() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.coreObjects.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.coreObject.php');
}
}
parent::uninstall();
// clear cache immediately
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.eventListener-*.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.eventListener.php');
}
}
*/
protected function getDefinitionID($definitionName) {
// get object type id
- $sql = "SELECT object_type_definition.definitionID
- FROM wcf".WCF_N."_package_dependency package_dependency,
- wcf".WCF_N."_object_type_definition object_type_definition
- WHERE object_type_definition.packageID = package_dependency.dependency
- AND package_dependency.packageID = ?
- AND object_type_definition.definitionName = ?
- ORDER BY package_dependency.priority DESC";
+ $sql = "SELECT definitionID
+ FROM wcf".WCF_N."_object_type_definition
+ WHERE definitionName = ?";
$statement = WCF::getDB()->prepareStatement($sql, 1);
- $statement->execute(array($this->installation->getPackageID(), $definitionName));
+ $statement->execute(array($definitionName));
$row = $statement->fetchArray();
if (empty($row['definitionID'])) throw new SystemException("unknown object type definition '".$definitionName."' given");
return $row['definitionID'];
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
*/
protected function cleanup() {
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.sitemap-*.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.sitemap.php');
}
}
*/
protected function cleanup() {
// clear cache immediately
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.templateListener-*.php');
+ CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.templateListener.php');
CacheHandler::getInstance()->clear(WCF_DIR.'cache/templateListener', '*.php');
}
}
<?php
namespace wcf\system\search\acp;
-use wcf\system\application\ApplicationHandler;
use wcf\system\cache\CacheHandler;
use wcf\system\exception\SystemException;
use wcf\system\SingletonFactory;
* @see wcf\system\SingletonFactory::init()
*/
protected function init() {
- $application = ApplicationHandler::getInstance()->getPrimaryApplication();
- $cacheName = 'acpSearchProvider-'.$application->packageID;
-
CacheHandler::getInstance()->addResource(
- $cacheName,
- WCF_DIR.'cache/cache.'.$cacheName.'.php',
+ 'acpSearchProvider',
+ WCF_DIR.'cache/cache.acpSearchProvider.php',
'wcf\system\cache\builder\ACPSearchProviderCacheBuilder'
);
- $this->cache = CacheHandler::getInstance()->get($cacheName);
+ $this->cache = CacheHandler::getInstance()->get('acpSearchProvider');
}
/**
<?php
namespace wcf\system\search\acp;
use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("languageID = ?", array(WCF::getLanguage()->languageID));
$conditions->add("languageItemValue LIKE ?", array($query.'%'));
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
// filter by language item
$languageItemsConditions = '';
<?php
namespace wcf\system\search\acp;
use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("languageID = ?", array(WCF::getLanguage()->languageID));
$conditions->add("languageItemValue LIKE ?", array($query.'%'));
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
// filter by language item
$languageItemsConditions = '';
<?php
namespace wcf\system\search\acp;
use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;
$conditions->add("languageID = ?", array(WCF::getLanguage()->languageID));
$conditions->add("languageItem LIKE ?", array('wcf.acp.package.packageName.package%'));
$conditions->add("languageItemValue LIKE ?", array($query.'%'));
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
$sql = "SELECT languageItem
FROM wcf".WCF_N."_language_item
<?php
namespace wcf\system\search\acp;
use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("languageID = ?", array(WCF::getLanguage()->languageID));
$conditions->add("languageItemValue LIKE ?", array($query.'%'));
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
// filter by language item
$languageItemsConditions = '';
$groupsFileName = StringUtil::getHash($groups);
// register cache resource
- $cacheName = 'groups-'.PACKAGE_ID.'-'.$groups;
+ $cacheName = 'userGroup-'.$groups;
CacheHandler::getInstance()->addResource(
$cacheName,
- WCF_DIR.'cache/cache.userGroups-'.PACKAGE_ID.'-'.$groupsFileName.'.php',
+ WCF_DIR.'cache/cache.userGroup-'.$groupsFileName.'.php',
'wcf\system\cache\builder\UserGroupPermissionCacheBuilder'
);
<?php
namespace wcf\system\sitemap;
-use wcf\system\application\ApplicationHandler;
use wcf\system\cache\CacheHandler;
use wcf\system\exception\SystemException;
use wcf\system\SingletonFactory;
* @see wcf\system\SingletonFactory::init()
*/
protected function init() {
- $application = ApplicationHandler::getInstance()->getPrimaryApplication();
- $cacheName = 'sitemap-'.$application->packageID;
-
CacheHandler::getInstance()->addResource(
- $cacheName,
- WCF_DIR.'cache/cache.'.$cacheName.'.php',
+ 'sitemap',
+ WCF_DIR.'cache/cache.sitemap.php',
'wcf\system\cache\builder\SitemapCacheBuilder'
);
- $this->cache = CacheHandler::getInstance()->get($cacheName);
+ $this->cache = CacheHandler::getInstance()->get('sitemap');
}
/**
// read stylesheets by dependency order
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("file_log.filename REGEXP ?", array('style/([a-zA-Z0-9\_\-\.]+)\.less'));
- $conditions->add("package_dependency.packageID = ?", array(ApplicationHandler::getInstance()->getPrimaryApplication()->packageID));
$sql = "SELECT file_log.filename, package.packageDir
FROM wcf".WCF_N."_package_installation_file_log file_log
- LEFT JOIN wcf".WCF_N."_package_dependency package_dependency
- ON (file_log.packageID = package_dependency.dependency)
LEFT JOIN wcf".WCF_N."_package package
ON (file_log.packageID = package.packageID)
- ".$conditions."
- ORDER BY package_dependency.priority ASC";
+ ".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
$files = array();
}
$this->compileStylesheet(
- WCF_DIR.'style/style-'.ApplicationHandler::getInstance()->getPrimaryApplication()->packageID.'-'.$style->styleID,
+ WCF_DIR.'style/style-'.$style->styleID,
$files,
$variables,
$individualLess,
namespace wcf\system\style;
use wcf\data\style\ActiveStyle;
use wcf\data\style\Style;
-use wcf\system\application\ApplicationHandler;
use wcf\system\cache\CacheHandler;
use wcf\system\exception\SystemException;
use wcf\system\request\RequestHandler;
protected function init() {
// load cache
CacheHandler::getInstance()->addResource(
- 'styles',
- WCF_DIR.'cache/cache.styles.php',
+ 'style',
+ WCF_DIR.'cache/cache.style.php',
'wcf\system\cache\builder\StyleCacheBuilder'
);
- $this->cache = CacheHandler::getInstance()->get('styles');
+ $this->cache = CacheHandler::getInstance()->get('style');
}
/**
}
else {
// frontend
- $filename = 'style/style-'.ApplicationHandler::getInstance()->getPrimaryApplication()->packageID.'-'.$this->getStyle()->styleID.'.css';
+ $filename = 'style/style-'.$this->getStyle()->styleID.'.css';
if (!file_exists(WCF_DIR.$filename)) {
StyleCompiler::getInstance()->compile($this->getStyle()->getDecoratedObject());
}
* @param wcf\data\style\Style $style
*/
public function resetStylesheet(Style $style) {
- $stylesheets = glob(WCF_DIR.'style/style-*-'.$style->styleID.'*.css');
+ $stylesheets = glob(WCF_DIR.'style/style-'.$style->styleID.'*.css');
foreach ($stylesheets as $stylesheet) {
@unlink($stylesheet);
}
* @param string $templateName
*/
public function getCompiledFilename($templateName) {
- return $this->compileDir.PACKAGE_ID.'_'.$this->templateGroupID.'_'.$this->languageID.'_'.$templateName.'.php';
+ return $this->compileDir.$this->templateGroupID.'_'.$this->languageID.'_'.$templateName.'.php';
}
/**
* @param string $templateName
*/
public function getMetaDataFilename($templateName) {
- return $this->compileDir.PACKAGE_ID.'_'.$this->templateGroupID.'_'.$templateName.'.meta.php';
+ return $this->compileDir.$this->templateGroupID.'_'.$templateName.'.meta.php';
}
/**
if ($this->hasTemplateListeners($templateName)) {
$this->loadTemplateListenerCode($templateName);
- $templateListenerCache = WCF_DIR.'cache/templateListener/'.PACKAGE_ID.'-'.$this->environment.'-'.$templateName.'.php';
+ $templateListenerCache = WCF_DIR.'cache/templateListener/'.$this->environment.'-'.$templateName.'.php';
$templateListenerCacheMTime = @filemtime($templateListenerCache);
return !($sourceMTime >= $templateListenerCacheMTime);
*/
protected function loadTemplateGroupCache() {
CacheHandler::getInstance()->addResource(
- 'templateGroups',
- WCF_DIR.'cache/cache.templateGroups.php',
+ 'templateGroup',
+ WCF_DIR.'cache/cache.templateGroup.php',
'wcf\system\cache\builder\TemplateGroupCacheBuilder'
);
- $this->templateGroupCache = CacheHandler::getInstance()->get('templateGroups');
+ $this->templateGroupCache = CacheHandler::getInstance()->get('templateGroup');
}
/**
* Loads all available template listeners.
*/
protected function loadTemplateListeners() {
- $cacheName = 'templateListener-'.PACKAGE_ID.'-'.$this->environment;
+ $cacheName = 'templateListener-'.$this->environment;
CacheHandler::getInstance()->addResource(
$cacheName,
WCF_DIR.'cache/cache.'.$cacheName.'.php',
// cache was already loaded
if (!isset($this->templateListeners[$templateName]) || !empty($this->templateListeners[$templateName])) return;
- $cacheName = PACKAGE_ID.'-'.$this->environment.'-'.$templateName;
+ $cacheName = $this->environment.'-'.$templateName;
CacheHandler::getInstance()->addResource(
$cacheName,
WCF_DIR.'cache/templateListener/'.$cacheName.'.php',
'wcf\system\cache\builder\TemplateListenerCodeCacheBuilder'
);
-
$this->templateListeners[$templateName] = CacheHandler::getInstance()->get($cacheName);
}
<?php
namespace wcf\system\user\storage;
use wcf\system\database\util\PreparedStatementConditionBuilder;
-use wcf\system\package\PackageDependencyHandler;
use wcf\system\SingletonFactory;
use wcf\system\WCF;
* Loads storage for a given set of users.
*
* @param array<integer> $userIDs
- * @param integer $packageID
*/
- public function loadStorage(array $userIDs, $packageID = PACKAGE_ID) {
+ public function loadStorage(array $userIDs) {
$tmp = array();
foreach ($userIDs as $userID) {
if (!isset($this->cache[$userID])) $tmp[] = $userID;
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("userID IN (?)", array($tmp));
- $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies($packageID)));
$sql = "SELECT *
FROM wcf".WCF_N."_user_storage
* @param integer $userID
* @param string $field
* @param string $fieldValue
- * @param integer $packageID
*/
- public function update($userID, $field, $fieldValue, $packageID = PACKAGE_ID) {
- $this->updateFields[$userID][$packageID][$field] = $fieldValue;
+ public function update($userID, $field, $fieldValue) {
+ $this->updateFields[$userID][$field] = $fieldValue;
// update data cache for given user
if (!isset($this->cache[$userID])) {
$this->cache[$userID][$field] = $fieldValue;
// flag key as outdated
- self::reset(array($userID), $field, $packageID);
+ self::reset(array($userID), $field);
}
/**
*
* @param array<integer> $userIDs
* @param string $field
- * @param integer $packageID
*/
- public function reset(array $userIDs, $field, $packageID = PACKAGE_ID) {
+ public function reset(array $userIDs, $field) {
foreach ($userIDs as $userID) {
- $this->resetFields[$userID][$packageID][] = $field;
+ $this->resetFields[$userID][] = $field;
if (isset($this->cache[$userID][$field])) {
unset($this->cache[$userID][$field]);
* Removes a specific data record for all users.
*
* @param string $field
- * @param integer $packageID
*/
- public function resetAll($field, $packageID = PACKAGE_ID) {
+ public function resetAll($field) {
$sql = "DELETE FROM wcf".WCF_N."_user_storage
- WHERE field = ?
- AND packageID = ?";
+ WHERE field = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
- $field,
- $packageID
- ));
+ $statement->execute(array($field));
foreach ($this->cache as $userID => $fields) {
if (isset($fields[$field])) {
if (!empty($this->resetFields)) {
$sql = "DELETE FROM wcf".WCF_N."_user_storage
WHERE userID = ?
- AND field = ?
- AND packageID = ?";
+ AND field = ?";
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($this->resetFields as $userID => $data) {
- foreach ($data as $packageID => $fields) {
+ foreach ($data as $fields) {
foreach ($fields as $field) {
$statement->execute(array(
$userID,
- $field,
- $packageID
+ $field
));
}
}
// insert data
if (!empty($this->updateFields)) {
$sql = "INSERT INTO wcf".WCF_N."_user_storage
- (userID, field, fieldValue, packageID)
- VALUES (?, ?, ?, ?)";
+ (userID, field, fieldValue)
+ VALUES (?, ?, ?)";
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($this->updateFields as $userID => $data) {
- foreach ($data as $packageID => $fieldValues) {
+ foreach ($data as $fieldValues) {
foreach ($fieldValues as $field => $fieldValue) {
$statement->execute(array(
$userID,
$field,
- $fieldValue,
- $packageID
+ $fieldValue
));
}
}
DROP TABLE IF EXISTS wcf1_acp_session;
CREATE TABLE wcf1_acp_session (
sessionID CHAR(40) NOT NULL PRIMARY KEY,
- packageID INT(10),
userID INT(10),
ipAddress VARCHAR(39) NOT NULL DEFAULT '',
userAgent VARCHAR(255) NOT NULL DEFAULT '',
CREATE TABLE wcf1_acp_session_access_log (
sessionAccessLogID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
sessionLogID INT(10) NOT NULL,
- packageID INT(10),
ipAddress VARCHAR(39) NOT NULL DEFAULT '',
time INT(10) NOT NULL DEFAULT 0,
requestURI VARCHAR(255) NOT NULL DEFAULT '',
domainPath VARCHAR(255) NOT NULL DEFAULT '/',
cookieDomain VARCHAR(255) NOT NULL,
cookiePath VARCHAR(255) NOT NULL DEFAULT '/',
- groupID INT(10),
isPrimary TINYINT(1) NOT NULL DEFAULT 0
);
-DROP TABLE IF EXISTS wcf1_application_group;
-CREATE TABLE wcf1_application_group (
- groupID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
- groupName VARCHAR(255) NOT NULL
-);
-
DROP TABLE IF EXISTS wcf1_cache_resource;
CREATE TABLE wcf1_cache_resource (
cacheResource VARCHAR(255) NOT NULL PRIMARY KEY
languageItemOriginIsSystem TINYINT(1) NOT NULL DEFAULT 1,
languageCategoryID INT(10) NOT NULL,
packageID INT(10),
- UNIQUE KEY languageItem (languageItem, packageID, languageID),
+ UNIQUE KEY languageItem (languageItem, languageID),
KEY languageItemOriginIsSystem (languageItemOriginIsSystem)
);
disabled TINYINT(1) NOT NULL DEFAULT 0
);
-DROP TABLE IF EXISTS wcf1_language_to_package;
-CREATE TABLE wcf1_language_to_package (
- languageID INT(10) NOT NULL,
- packageID INT(10),
- UNIQUE KEY languageID (languageID, packageID)
-);
-
DROP TABLE IF EXISTS wcf1_modification_log;
CREATE TABLE wcf1_modification_log (
logID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
KEY package (package)
);
-DROP TABLE IF EXISTS wcf1_package_dependency;
-CREATE TABLE wcf1_package_dependency (
- packageID INT(10) NOT NULL,
- dependency INT(10) NOT NULL,
- priority INT(10) NOT NULL DEFAULT 0,
- UNIQUE KEY packageID (packageID, dependency)
-);
-
DROP TABLE IF EXISTS wcf1_package_exclusion;
CREATE TABLE wcf1_package_exclusion (
packageID INT(10) NOT NULL,
DROP TABLE IF EXISTS wcf1_session;
CREATE TABLE wcf1_session (
sessionID CHAR(40) NOT NULL PRIMARY KEY,
- packageID INT(10) NOT NULL,
userID INT(10),
ipAddress VARCHAR(39) NOT NULL DEFAULT '',
userAgent VARCHAR(255) NOT NULL DEFAULT '',
imagePath VARCHAR(255) NOT NULL DEFAULT ''
);
-DROP TABLE IF EXISTS wcf1_style_to_package;
-CREATE TABLE wcf1_style_to_package (
- styleID INT(10) NOT NULL,
- packageID INT(10) NOT NULL,
- isDefault TINYINT(1) NOT NULL DEFAULT 0,
- disabled TINYINT(1) NOT NULL DEFAULT 0,
- UNIQUE KEY (styleID, packageID)
-);
-
DROP TABLE IF EXISTS wcf1_style_variable;
CREATE TABLE wcf1_style_variable (
variableID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
userID INT(10) NOT NULL,
field VARCHAR(80) NOT NULL DEFAULT '',
fieldValue TEXT,
- packageID INT(10),
UNIQUE KEY userStorageData (userID, field, packageID)
);
ALTER TABLE wcf1_acp_search_provider ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
ALTER TABLE wcf1_acp_session ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
-ALTER TABLE wcf1_acp_session ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
ALTER TABLE wcf1_acp_session_access_log ADD FOREIGN KEY (sessionLogID) REFERENCES wcf1_acp_session_log (sessionLogID) ON DELETE CASCADE;
-ALTER TABLE wcf1_acp_session_access_log ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE SET NULL;
ALTER TABLE wcf1_acp_session_log ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
ALTER TABLE wcf1_acp_template ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
ALTER TABLE wcf1_application ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
-ALTER TABLE wcf1_application ADD FOREIGN KEY (groupID) REFERENCES wcf1_application_group (groupID) ON DELETE SET NULL;
ALTER TABLE wcf1_category ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_object_type (objectTypeID) ON DELETE CASCADE;
ALTER TABLE wcf1_language_item ADD FOREIGN KEY (languageCategoryID) REFERENCES wcf1_language_category (languageCategoryID) ON DELETE CASCADE;
ALTER TABLE wcf1_language_item ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
-ALTER TABLE wcf1_language_to_package ADD FOREIGN KEY (languageID) REFERENCES wcf1_language (languageID) ON DELETE CASCADE;
-ALTER TABLE wcf1_language_to_package ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
-
ALTER TABLE wcf1_modification_log ADD FOREIGN KEY (objectTypeID) REFERENCES wcf1_object_type (objectTypeID) ON DELETE CASCADE;
ALTER TABLE wcf1_modification_log ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
ALTER TABLE wcf1_option_category ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
-ALTER TABLE wcf1_package_dependency ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
-ALTER TABLE wcf1_package_dependency ADD FOREIGN KEY (dependency) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
-
ALTER TABLE wcf1_package_exclusion ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
ALTER TABLE wcf1_package_installation_file_log ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
ALTER TABLE wcf1_search ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
-ALTER TABLE wcf1_session ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
ALTER TABLE wcf1_session ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
ALTER TABLE wcf1_sitemap ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
ALTER TABLE wcf1_user_storage ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
-ALTER TABLE wcf1_user_storage ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
ALTER TABLE wcf1_style ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
-ALTER TABLE wcf1_style_to_package ADD FOREIGN KEY (styleID) REFERENCES wcf1_style (styleID) ON DELETE CASCADE;
-ALTER TABLE wcf1_style_to_package ADD FOREIGN KEY (packageID) REFERENCES wcf1_package (packageID) ON DELETE CASCADE;
-
ALTER TABLE wcf1_style_variable_value ADD FOREIGN KEY (styleID) REFERENCES wcf1_style (styleID) ON DELETE CASCADE;
ALTER TABLE wcf1_style_variable_value ADD FOREIGN KEY (variableID) REFERENCES wcf1_style_variable (variableID) ON DELETE CASCADE;