<?php declare(strict_types=1);
namespace Weedesign\Images2WebP;
use Composer\Autoload\ClassLoader;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\Plugin;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Shopware\Core\Framework\Plugin\Context\UninstallContext;
use Shopware\Core\Framework\Plugin\Context\DeactivateContext;
use Shopware\Core\Framework\Plugin\Context\UpdateContext;
use Shopware\Core\System\SystemConfig\SystemConfigService;
use Weedesign\Images2WebP\Controller\Media\DeleteController;
class WeedesignImages2WebP extends Plugin
{
public function uninstall(UninstallContext $context): void
{
parent::uninstall($context);
if ($context->keepUserData()) {
return;
}
$deleteController = new DeleteController();
$deleteMedia = $deleteController->check();
}
public function update(UpdateContext $context): void
{
$systemConfigService = $this->container->get(SystemConfigService::class);
if(empty($systemConfigService->get('WeedesignImages2WebP.config.fallback'))) {
$systemConfigService->set('WeedesignImages2WebP.config.fallback',1);
}
if(empty($systemConfigService->get('WeedesignImages2WebP.config.logo'))) {
$systemConfigService->set('WeedesignImages2WebP.config.logo',0);
}
if(empty($systemConfigService->get('WeedesignImages2WebP.config.backlink'))) {
$systemConfigService->set('WeedesignImages2WebP.config.backlink',0);
}
if(empty($systemConfigService->get('WeedesignImages2WebP.config.email'))) {
$systemConfigService->set('WeedesignImages2WebP.config.email','support@weedesign.de');
}
}
}