return call_user_func_array(array($this->object, $name), $arguments);
}
+ /**
+ * @see wcf\data\IStorableObject::getDatabaseTableAlias()
+ */
+ public static function getDatabaseTableAlias() {
+ return call_user_func(array(static::$baseClass, 'getDatabaseTableAlias'));
+ }
+
/**
* @see wcf\data\IStorableObject::getDatabaseTableName()
*/
* This PIP installs, updates or deletes acp-menu items.
*
* @author Alexander Ebert
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$className
*/
public $className = 'wcf\data\acp\menu\item\ACPMenuItemEditor';
-
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'acp_menu_item';
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
- */
- public $tagName = 'acpmenuitem';
}
*/
public $className = 'wcf\data\acp\search\provider\ACPSearchProviderEditor';
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'acp_search_provider';
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
- */
- public $tagName = 'acpsearchprovider';
-
/**
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::handleDelete()
*/
protected function cleanup() {
CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.acpSearchProvider-*.php');
}
-
- /**
- * @see wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
- */
- public function uninstall() {
- parent::uninstall();
-
- // clear cache immediately
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.acpSearchProvider-*.php');
- }
}
* This PIP installs, updates or deletes by a package delivered ACP templates.
*
* @author Benjamin Kunz
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
*/
public $tableName = 'acp_template';
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
- */
- public $tagName = 'acptemplate';
-
/**
* @see wcf\system\package\plugin\IPackageInstallationPlugin::install()
*/
namespace wcf\system\package\plugin;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\exception\SystemException;
+use wcf\system\package\PackageInstallationDispatcher;
use wcf\system\WCF;
use wcf\util\FileUtil;
use wcf\util\XML;
* Default implementation of some functions for a PackageInstallationPlugin using xml definitions.
*
* @author Marcel Werk
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
*/
public $tagName = '';
+ /**
+ * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::install()
+ */
+ public function __construct(PackageInstallationDispatcher $installation, $instruction = array()) {
+ parent::__construct($installation, $instruction);
+
+ // autoset 'tableName' property
+ if (empty($this->tableName) && !empty($this->className)) {
+ $this->tableName = call_user_func(array($this->className, 'getDatabaseTableAlias'));
+ }
+
+ // autoset 'tagName' property
+ if (empty($this->tagName) && !empty($this->tableName)) {
+ $this->tagName = str_replace('_', '', $this->tableName);
+ }
+ }
+
/**
* @see wcf\system\package\plugin\IPackageInstallationPlugin::install()
*/
// handle import
$this->importItems($xpath);
- // execute cleanup after successfull import/delete/update
+ // execute cleanup
+ $this->cleanup();
+ }
+
+ /**
+ * @see wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
+ */
+ public function uninstall() {
+ parent::uninstall();
+
+ // execute cleanup
$this->cleanup();
}
*
* @param array $items
*/
- abstract protected function handleDelete(array $items);
+ protected abstract function handleDelete(array $items);
/**
* Prepares import, use this to map xml tags and attributes
* @param array $data
* @return array
*/
- abstract protected function prepareImport(array $data);
+ protected abstract function prepareImport(array $data);
/**
* Validates given item, e.g. checking for invalid values. If validation
* @param array $data
* @return array
*/
- abstract protected function findExistingItem(array $data);
+ protected abstract function findExistingItem(array $data);
/**
* Append additional fields which are not to be updated if a corresponding
* This PIP installs, updates or deletes clipboard actions.
*
* @author Alexander Ebert
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage acp.package.plugin
*/
protected $pages = array();
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'clipboard_action';
-
/**
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
*/
* This PIP installs, updates or deletes core objects.
*
* @author Alexander Ebert
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
*/
public $className = 'wcf\data\core\object\CoreObjectEditor';
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'core_object';
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
- */
- public $tagName = 'coreobject';
-
/**
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::handleDelete()
*/
protected function cleanup() {
CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.coreObjects.php');
}
-
- /**
- * @see wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
- */
- public function uninstall() {
- parent::uninstall();
-
- // clear cache immediately
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.coreObjects.php');
- }
}
* This PIP installs, updates or deletes cronjobs.
*
* @author Alexander Ebert
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage acp.package.plugin
*/
public $className = 'wcf\data\cronjob\CronjobEditor';
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'cronjob';
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
- */
- public $tagName = 'cronjob';
-
/**
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::handleDelete()
*/
* This PIP installs, updates or deletes event listeners.
*
* @author Marcel Werk
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
*/
public $className = 'wcf\data\event\listener\EventListenerEditor';
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'event_listener';
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
- */
- public $tagName = 'eventlistener';
-
/**
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::handleDelete()
*/
* This PIP installs, updates or deletes object type definitions.
*
* @author Alexander Ebert
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage acp.package.plugin
*/
public $className = 'wcf\data\object\type\definition\ObjectTypeDefinitionEditor';
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'object_type_definition';
-
/**
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
*/
* This PIP installs, updates or deletes object types.
*
* @author Alexander Ebert
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage acp.package.plugin
*/
public $className = 'wcf\data\object\type\ObjectTypeEditor';
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'object_type';
-
/**
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
*/
public $tagName = 'type';
/**
- * list of reserved tags
- * @var array
+ * list of names of tags which aren't considered as additional data
+ * @var array<string>
*/
public static $reservedTags = array('classname', 'definitionname', 'name');
*/
public $tableName = 'option';
+ /**
+ * list of names of tags which aren't considered as additional data
+ * @var array<string>
+ */
public static $reservedTags = array('name', 'optiontype', 'defaultvalue', 'validationpattern', 'enableoptions', 'showorder', 'hidden', 'selectoptions', 'categoryname', 'permissions', 'options', 'attrs', 'cdata', 'supporti18n');
/**
* This PIP installs, updates or deletes package installation plugins.
*
* @author Marcel Werk
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
*/
public $className = 'wcf\data\package\installation\plugin\PackageInstallationPluginEditor';
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'package_installation_plugin';
-
/**
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
*/
+++ /dev/null
-<?php
-namespace wcf\system\package\plugin;
-use wcf\system\WCF;
-
-/**
- * This PIP installs, updates or deletes page locations.
- *
- * @author Marcel Werk
- * @copyright 2001-2011 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf.page
- * @subpackage system.package.plugin
- * @category Community Framework
- */
-class PageLocationPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin {
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$className
- */
- public $className = 'wcf\data\page\location\PageLocationEditor';
-
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'page_location';
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
- */
- public $tagName = 'pagelocation';
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::handleDelete()
- */
- protected function handleDelete(array $items) {
- $sql = "DELETE FROM wcf".WCF_N."_".$this->tableName."
- WHERE locationName = ?
- AND packageID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- foreach ($items as $item) {
- $statement->execute(array(
- $item['attributes']['name'],
- $this->installation->getPackageID()
- ));
- }
- }
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport()
- */
- protected function prepareImport(array $data) {
- return array(
- 'classPath' => (isset($data['elements']['classpath'])) ? $data['elements']['classpath'] : '',
- 'locationName' => $data['attributes']['name'],
- 'locationPattern' => $data['elements']['pattern']
- );
- }
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::findExistingItem()
- */
- protected function findExistingItem(array $data) {
- $sql = "SELECT *
- FROM wcf".WCF_N."_".$this->tableName."
- WHERE locationName = ?
- AND packageID = ?";
- $parameters = array(
- $data['locationName'],
- $this->installation->getPackageID()
- );
-
- return array(
- 'sql' => $sql,
- 'parameters' => $parameters
- );
- }
-}
* This PIP installs, updates or deletes page page menu items.
*
* @author Marcel Werk
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
*/
public $className = 'wcf\data\page\menu\item\PageMenuItemEditor';
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'page_menu_item';
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
- */
- public $tagName = 'pagemenuitem';
-
/**
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport()
*/
*/
public $className = 'wcf\data\sitemap\SitemapEditor';
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'sitemap';
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
- */
- public $tagName = 'sitemap';
-
/**
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::handleDelete()
*/
protected function cleanup() {
CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.sitemap-*.php');
}
-
- /**
- * @see wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
- */
- public function uninstall() {
- parent::uninstall();
-
- // clear cache immediately
- CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.sitemap-*.php');
- }
}
}
/**
- * @see wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
- */
- public function uninstall() {
- parent::uninstall();
-
- $this->cleanup();
- }
-
- /**
- * Updates styles files of all styles.
- */
+ * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
+ */
protected function cleanup() {
// get all styles
$styleList = new StyleList();
$styleList->sqlLimit = 0;
$styleList->readObjects();
+ // update style files
foreach ($styleList->getObjects() as $style) {
$styleEditor = new StyleEditor($style);
$styleEditor->writeStyleFile();
* This PIP installs, updates or deletes styles.
*
* @author Marcel Werk
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
*/
public $className = 'wcf\data\style\StyleEditor';
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'style';
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
- */
- public $tagName = 'style';
-
/**
* @see wcf\system\package\plugin\IPackageInstallationPlugin::install()
*/
* This PIP installs, updates or deletes template listeners.
*
* @author Alexander Ebert
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
*/
public $className = 'wcf\data\template\listener\TemplateListenerEditor';
- /**
- * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
- */
- public $tableName = 'template_listener';
-
- /**
- * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
- */
- public $tagName = 'templatelistener';
-
/**
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::handleDelete()
*/
);
}
- /**
- * @see wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
- */
- public function uninstall() {
- parent::uninstall();
-
- $this->cleanup();
- }
-
/**
* @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
*/
*/
public $tableName = 'user_group_option';
+ /**
+ * list of names of tags which aren't considered as additional data
+ * @var array<string>
+ */
public static $reservedTags = array('name', 'optiontype', 'defaultvalue', 'admindefaultvalue', 'validationpattern', 'showorder', 'categoryname', 'selectoptions', 'enableoptions', 'permissions', 'options', 'attrs', 'cdata');
/**
* This PIP installs, updates or deletes user fields.
*
* @author Benjamin Kunz
- * @copyright 2001-2011 WoltLab GmbH
+ * @copyright 2001-2012 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.package.plugin
* @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
*/
public $tableName = 'user_option';
-
+
+ /**
+ * list of names of tags which aren't considered as additional data
+ * @var array<string>
+ */
public static $reservedTags = array('name', 'optiontype', 'defaultvalue', 'validationpattern', 'required', 'editable', 'visible', 'searchable', 'showorder', 'outputclass', 'selectoptions', 'enableoptions', 'disabled', 'categoryname', 'permissions', 'options', 'attrs', 'cdata');
/**