Some checks failed
Telegram Mini App Shop Builder / Compute version metadata (push) Has been cancelled
Telegram Mini App Shop Builder / Run Frontend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run Backend tests (push) Has been cancelled
Telegram Mini App Shop Builder / Run PHP_CodeSniffer (push) Has been cancelled
Telegram Mini App Shop Builder / Build module. (push) Has been cancelled
Telegram Mini App Shop Builder / release (push) Has been cancelled
44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Console\Commands;
|
|
|
|
use Openguru\OpenCartFramework\Cache\CacheInterface;
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
|
|
|
class CacheClearCommand extends MegaPayCommand
|
|
{
|
|
protected static $defaultName = 'cache:clear';
|
|
protected static $defaultDescription = 'Очистка кеша модуля MegaPay';
|
|
|
|
private CacheInterface $cache;
|
|
|
|
public function __construct(CacheInterface $cache)
|
|
{
|
|
parent::__construct();
|
|
$this->cache = $cache;
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
{
|
|
$io = new SymfonyStyle($input, $output);
|
|
|
|
$io->title('Очистка кеша модуля MegaPay');
|
|
|
|
try {
|
|
$this->cache->clear();
|
|
$io->success('Кеш успешно очищен!');
|
|
|
|
return Command::SUCCESS;
|
|
} catch (\Exception $e) {
|
|
$io->error('Ошибка при очистке кеша: ' . $e->getMessage());
|
|
|
|
return Command::FAILURE;
|
|
}
|
|
}
|
|
}
|