<?phpdeclare(strict_types=1);namespace Iwv\IwvDatevV6;if (file_exists(dirname(__DIR__) . '/vendor/autoload.php')) { $loader = require_once dirname(__DIR__) . '/vendor/autoload.php'; if ($loader !== true) { spl_autoload_unregister([$loader, 'loadClass']); $loader->register(false); }}use Doctrine\DBAL\Connection;use Shopware\Core\Framework\Plugin\Context\UninstallContext;use Shopware\Core\Framework\Plugin;use League\Flysystem\Filesystem;use Iwv\IwvDatevV6\Core\Content\IwvDatev\ScheduledExportDefinition;use Iwv\IwvDatevV6\Core\Content\IwvExtendedDocument\IwvExtDocDocumentPosition\IwvExtDocDocumentPositionDefinition;use Iwv\IwvDatevV6\Core\Content\IwvExtendedDocument\IwvExtDocDocumentData\IwvExtDocDocumentDataDefinition;use Iwv\IwvDatevV6\Core\Content\IwvExtendedDocument\IwvExtDocAddressBilling\IwvExtDocAddressBillingDefinition;use Iwv\IwvDatevV6\Core\Content\IwvExtendedDocument\IwvExtDocAddressShipping\IwvExtDocAddressShippingDefinition;use Shopware\Core\Framework\Api\Acl\Role\AclRoleDefinition;class IwvDatevV6 extends Plugin{ public function enrichPrivileges(): array { $iwvExtDocPrivileges = [ 'iwv_datev_v6_ext_doc_document_data:create', 'iwv_datev_v6_ext_doc_address_billing:create', 'iwv_datev_v6_ext_doc_address_shipping:create', 'iwv_datev_v6_ext_doc_document_position:create', 'iwv_datev_v6_ext_doc_document_data:read', 'iwv_datev_v6_ext_doc_address_billing:read', 'iwv_datev_v6_ext_doc_address_shipping:read', 'iwv_datev_v6_ext_doc_document_position:read', 'iwv_datev_v6_ext_doc_document_data:update', 'iwv_datev_v6_ext_doc_address_billing:update', 'iwv_datev_v6_ext_doc_address_shipping:update', 'iwv_datev_v6_ext_doc_document_position:update', 'iwv_datev_v6_ext_doc_document_data:delete', 'iwv_datev_v6_ext_doc_address_billing:delete', 'iwv_datev_v6_ext_doc_address_shipping:delete', 'iwv_datev_v6_ext_doc_document_position:delete', ]; return [ 'additional_permissions' => [ 'iwv_export_datev:export', ], 'document.viewer' => $iwvExtDocPrivileges, 'document.editor' => $iwvExtDocPrivileges, 'document.creator' => $iwvExtDocPrivileges, 'document.deleter' => $iwvExtDocPrivileges, AclRoleDefinition::ALL_ROLE_KEY => $iwvExtDocPrivileges ]; } public function uninstall(UninstallContext $context): void { if ($context->keepUserData()) { return; } $connection = $this->container->get(Connection::class); $connection->executeUpdate('DELETE FROM system_config WHERE `configuration_key` LIKE "IwvDatevV6.config.%"'); $connection->exec(' SET FOREIGN_KEY_CHECKS = 0; -- Migration1645612676CreateTableIwvDatevScheduledExport.php DROP TABLE IF EXISTS `' . ScheduledExportDefinition::ENTITY_NAME . '`; -- Migration1652863370IwvExtDocAddressBilling.php DROP TABLE IF EXISTS `' . IwvExtDocAddressBillingDefinition::ENTITY_NAME . '`; -- Migration1652863390IwvExtDocAddressShipping.php DROP TABLE IF EXISTS `' . IwvExtDocAddressShippingDefinition::ENTITY_NAME . '`; -- Migration1652863365IwvExtDocDocumentPosition.php DROP TABLE IF EXISTS `' . IwvExtDocDocumentPositionDefinition::ENTITY_NAME . '`; -- Migration1652863360IwvExtDocDocumentData.php DROP TABLE IF EXISTS `' . IwvExtDocDocumentDataDefinition::ENTITY_NAME . '`; SET FOREIGN_KEY_CHECKS = 1; '); /** @var Filesystem $fs */ try { $fs = $this->container->get('shopware.filesystem.private'); $pluginPath = '/plugins/iwv_datev_v6'; if ($fs->has($pluginPath)) { $fs->deleteDir($pluginPath); } } catch (\Throwable $ex) { } parent::uninstall($context); }}