<?php
declare(strict_types=1);
namespace Iwv\IwvDatevV6;
if (file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
require_once dirname(__DIR__) . '/vendor/autoload.php';
}
use Doctrine\DBAL\Connection;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use Shopware\Core\Framework\Plugin;
use League\Flysystem\Filesystem;
class IwvDatevV6 extends Plugin
{
public function enrichPrivileges(): array
{
return [
'additional_permissions' => [
'iwv_export_datev:export',
],
];
}
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 `iwv_datev_v6_scheduled_export`;
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);
}
}