2 namespace wcf\system\package\plugin;
3 use wcf\system\cache\builder\ACPSearchProviderCacheBuilder;
7 * Installs, updates and deletes ACP search providers.
9 * @author Alexander Ebert
10 * @copyright 2001-2016 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\AbstractXMLPackageInstallationPlugin::handleDelete()
25 protected function handleDelete(array $items) {
26 $sql = "DELETE FROM wcf".WCF_N."_".$this->tableName."
27 WHERE providerName = ?
29 $statement = WCF::getDB()->prepareStatement($sql);
31 WCF::getDB()->beginTransaction();
32 foreach ($items as $item) {
34 $item['attributes']['name'],
35 $this->installation->getPackageID()
38 WCF::getDB()->commitTransaction();
42 * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::prepareImport()
44 protected function prepareImport(array $data) {
46 $showOrder = (isset($data['elements']['showorder'])) ? $data['elements']['showorder'] : null;
47 $showOrder = $this->getShowOrder($showOrder);
50 'className' => $data['elements']['classname'],
51 'providerName' => $data['attributes']['name'],
52 'showOrder' => $showOrder
57 * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::findExistingItem()
59 protected function findExistingItem(array $data) {
61 FROM wcf".WCF_N."_".$this->tableName."
62 WHERE providerName = ?
65 $data['providerName'],
66 $this->installation->getPackageID()
71 'parameters' => $parameters
76 * @see \wcf\system\package\plugin\AbstractXMLPackageInstallationPlugin::cleanup()
78 protected function cleanup() {
79 ACPSearchProviderCacheBuilder::getInstance()->reset();
83 * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
86 public static function getDefaultFilename() {
87 return 'acpSearchProvider.xml';