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);
40 foreach ($items as $item) {
41 $statement->execute(array(
42 $item['attributes']['name'],
43 $this->installation->getPackageID()
49 * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport()
51 protected function prepareImport(array $data) {
53 $showOrder = (isset($data['elements']['showorder'])) ? $data['elements']['showorder'] : null;
54 $showOrder = $this->getShowOrder($showOrder);
57 'className' => $data['elements']['classname'],
58 'providerName' => $data['attributes']['name'],
59 'showOrder' => $showOrder
64 * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::findExistingItem()
66 protected function findExistingItem(array $data) {
68 FROM wcf".WCF_N."_".$this->tableName."
69 WHERE providerName = ?
72 $data['providerName'],
73 $this->installation->getPackageID()
78 'parameters' => $parameters
83 * @see wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
85 protected function cleanup() {
86 CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.acpSearchProvider-*.php');
90 * @see wcf\system\package\plugin\IPackageInstallationPlugin::uninstall()
92 public function uninstall() {
95 // clear cache immediately
96 CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.acpSearchProvider-*.php');