2 declare(strict_types=1);
3 namespace wcf\system\package\plugin;
4 use wcf\data\object\type\definition\ObjectTypeDefinitionEditor;
5 use wcf\system\devtools\pip\IIdempotentPackageInstallationPlugin;
9 * Installs, updates and deletes object type definitions.
11 * @author Alexander Ebert
12 * @copyright 2001-2018 WoltLab GmbH
13 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14 * @package WoltLabSuite\Core\Acp\Package\Plugin
16 class ObjectTypeDefinitionPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin implements IIdempotentPackageInstallationPlugin {
20 public $className = ObjectTypeDefinitionEditor::class;
25 public $tagName = 'definition';
30 protected function handleDelete(array $items) {
31 $sql = "DELETE FROM wcf".WCF_N."_".$this->tableName."
32 WHERE definitionName = ?
34 $statement = WCF::getDB()->prepareStatement($sql);
35 foreach ($items as $item) {
37 $item['attributes']['name'],
38 $this->installation->getPackageID()
46 protected function prepareImport(array $data) {
48 'interfaceName' => isset($data['elements']['interfacename']) ? $data['elements']['interfacename'] : '',
49 'definitionName' => $data['elements']['name'],
50 'categoryName' => isset($data['elements']['categoryname']) ? $data['elements']['categoryname'] : ''
57 protected function findExistingItem(array $data) {
59 FROM wcf".WCF_N."_".$this->tableName."
60 WHERE definitionName = ?";
61 $parameters = [$data['definitionName']];
65 'parameters' => $parameters
72 public static function getSyncDependencies() {