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 WoltLabSuite\Core\System\Package\Plugin
15 class ACPSearchProviderPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin {
19 public $className = ACPSearchProviderEditor::class;
24 protected function handleDelete(array $items) {
25 $sql = "DELETE FROM wcf".WCF_N."_".$this->tableName."
26 WHERE providerName = ?
28 $statement = WCF::getDB()->prepareStatement($sql);
30 WCF::getDB()->beginTransaction();
31 foreach ($items as $item) {
33 $item['attributes']['name'],
34 $this->installation->getPackageID()
37 WCF::getDB()->commitTransaction();
43 protected function prepareImport(array $data) {
45 $showOrder = (isset($data['elements']['showorder'])) ? $data['elements']['showorder'] : null;
46 $showOrder = $this->getShowOrder($showOrder);
49 'className' => $data['elements']['classname'],
50 'providerName' => $data['attributes']['name'],
51 'showOrder' => $showOrder
58 protected function findExistingItem(array $data) {
60 FROM wcf".WCF_N."_".$this->tableName."
61 WHERE providerName = ?
64 $data['providerName'],
65 $this->installation->getPackageID()
70 'parameters' => $parameters
77 protected function cleanup() {
78 ACPSearchProviderCacheBuilder::getInstance()->reset();
82 * @see \wcf\system\package\plugin\IPackageInstallationPlugin::getDefaultFilename()
85 public static function getDefaultFilename() {
86 return 'acpSearchProvider.xml';