custom/plugins/IwvDatevV6/src/IwvDatevV6.php line 15

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Iwv\IwvDatevV6;
  4. if (file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
  5.     require_once dirname(__DIR__) . '/vendor/autoload.php';
  6. }
  7. use Doctrine\DBAL\Connection;
  8. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  9. use Shopware\Core\Framework\Plugin;
  10. use League\Flysystem\Filesystem;
  11. class IwvDatevV6 extends Plugin
  12. {
  13.     public function enrichPrivileges(): array
  14.     {
  15.         return [
  16.             'additional_permissions' => [
  17.                 'iwv_export_datev:export',
  18.             ],
  19.         ];
  20.     }
  21.     public function uninstall(UninstallContext $context): void
  22.     {
  23.         if ($context->keepUserData()) {
  24.             return;
  25.         }
  26.         $connection $this->container->get(Connection::class);
  27.         $connection->executeUpdate('DELETE FROM system_config WHERE `configuration_key` LIKE "IwvDatevV6.config.%"');
  28.         $connection->exec('
  29.             SET FOREIGN_KEY_CHECKS = 0;
  30.             -- Migration1645612676CreateTableIwvDatevScheduledExport.php
  31.             DROP TABLE IF EXISTS `iwv_datev_v6_scheduled_export`;
  32.             SET FOREIGN_KEY_CHECKS = 1;
  33.         ');
  34.         /** @var Filesystem $fs */
  35.         try {
  36.             $fs $this->container->get('shopware.filesystem.private');
  37.             $pluginPath '/plugins/iwv_datev_v6';
  38.             if ($fs->has($pluginPath)) {
  39.                 $fs->deleteDir($pluginPath);
  40.             }
  41.         } catch (\Throwable $ex) {
  42.             
  43.         }
  44.         parent::uninstall($context);
  45.     }
  46. }