2 namespace wcf\system\package\plugin;
3 use wcf\data\acp\search\provider\ACPSearchProviderEditor;
4 use wcf\system\cache\builder\ACPSearchProviderCacheBuilder;
8 * Installs, updates and deletes ACP search providers.
10 * @author Alexander Ebert
11 * @copyright 2001-2016 WoltLab GmbH
12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13 * @package com.woltlab.wcf
14 * @subpackage system.package.plugin
15 * @category Community Framework
17 class ACPSearchProviderPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin {
21 public $className = ACPSearchProviderEditor::class;
26 protected function handleDelete(array $items) {
27 $sql = "DELETE FROM wcf".WCF_N."_".$this->tableName."
28 WHERE providerName = ?
30 $statement = WCF::getDB()->prepareStatement($sql);
32 WCF::getDB()->beginTransaction();
33 foreach ($items as $item) {
35 $item['attributes']['name'],
36 $this->installation->getPackageID()
39 WCF::getDB()->commitTransaction();
45 protected function prepareImport(array $data) {
47 $showOrder = (isset($data['elements']['showorder'])) ? $data['elements']['showorder'] : null;
48 $showOrder = $this->getShowOrder($showOrder);
51 'className' => $data['elements']['classname'],
52 'providerName' => $data['attributes']['name'],
53 'showOrder' => $showOrder
60 protected function findExistingItem(array $data) {
62 FROM wcf".WCF_N."_".$this->tableName."
63 WHERE providerName = ?
66 $data['providerName'],
67 $this->installation->getPackageID()
72 'parameters' => $parameters
79 protected function cleanup() {
80 ACPSearchProviderCacheBuilder::getInstance()->reset();
84 * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
87 public static function getDefaultFilename() {
88 return 'acpSearchProvider.xml';