2 namespace wcf\system\package\plugin;
3 use wcf\data\object\type\definition\ObjectTypeDefinitionEditor;
4 use wcf\system\devtools\pip\IIdempotentPackageInstallationPlugin;
8 * Installs, updates and deletes object type definitions.
10 * @author Alexander Ebert
11 * @copyright 2001-2017 WoltLab GmbH
12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13 * @package WoltLabSuite\Core\Acp\Package\Plugin
15 class ObjectTypeDefinitionPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin implements IIdempotentPackageInstallationPlugin {
19 public $className = ObjectTypeDefinitionEditor::class;
24 public $tagName = 'definition';
29 protected function handleDelete(array $items) {
30 $sql = "DELETE FROM wcf".WCF_N."_".$this->tableName."
31 WHERE definitionName = ?
33 $statement = WCF::getDB()->prepareStatement($sql);
34 foreach ($items as $item) {
36 $item['attributes']['name'],
37 $this->installation->getPackageID()
45 protected function prepareImport(array $data) {
47 'interfaceName' => isset($data['elements']['interfacename']) ? $data['elements']['interfacename'] : '',
48 'definitionName' => $data['elements']['name'],
49 'categoryName' => isset($data['elements']['categoryname']) ? $data['elements']['categoryname'] : ''
56 protected function findExistingItem(array $data) {
58 FROM wcf".WCF_N."_".$this->tableName."
59 WHERE definitionName = ?";
60 $parameters = [$data['definitionName']];
64 'parameters' => $parameters