2 namespace wcf\system\package\plugin;
3 use wcf\system\cache\CacheHandler;
7 * This PIP installs, updates or deletes ACP search providers.
9 * @author Alexander Ebert
10 * @copyright 2001-2012 WoltLab GmbH
11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
12 * @package com.woltlab.wcf
13 * @subpackage system.package.plugin
14 * @category Community Framework
16 class ACPSearchProviderPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin {
18 * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$className
20 public $className = 'wcf\data\acp\search\provider\ACPSearchProviderEditor';
23 * @see wcf\system\package\plugin\AbstractPackageInstallationPlugin::$tableName
25 public $tableName = 'acp_search_provider';
28 * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::$tagName
30 public $tagName = 'acpsearchprovider';
33 * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::handleDelete()
35 protected function handleDelete(array $items) {
36 $sql = "DELETE FROM wcf".WCF_N."_".$this->tableName."
37 WHERE providerName = ?
39 $statement = WCF::getDB()->prepareStatement($sql);
41 WCF::getDB()->beginTransaction();
42 foreach ($items as $item) {
43 $statement->execute(array(
44 $item['attributes']['name'],
45 $this->installation->getPackageID()
48 WCF::getDB()->commitTransaction();
52 * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport()
54 protected function prepareImport(array $data) {
56 $showOrder = (isset($data['elements']['showorder'])) ? $data['elements']['showorder'] : null;
57 $showOrder = $this->getShowOrder($showOrder);
60 'className' => $data['elements']['classname'],
61 'providerName' => $data['attributes']['name'],
62 'showOrder' => $showOrder
67 * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::findExistingItem()
69 protected function findExistingItem(array $data) {
71 FROM wcf".WCF_N."_".$this->tableName."
72 WHERE providerName = ?
75 $data['providerName'],
76 $this->installation->getPackageID()
81 'parameters' => $parameters
86 * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
88 protected function cleanup() {
89 CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.acpSearchProvider-*.php');
93 * @see wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
95 public function uninstall() {
98 // clear cache immediately
99 CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.acpSearchProvider-*.php');