mirror of
https://github.com/slawkens/myaac.git
synced 2025-05-15 18:39:20 +02:00
36 lines
767 B
PHP
36 lines
767 B
PHP
<?php
|
|
|
|
namespace MyAAC\Commands;
|
|
|
|
use MyAAC\Hooks;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
|
|
|
class CacheClearCommand extends Command
|
|
{
|
|
protected function configure(): void
|
|
{
|
|
$this->setName('cache:clear')
|
|
->setDescription('This command clears the cache');
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
{
|
|
global $hooks;
|
|
$hooks = new Hooks();
|
|
$hooks->load();
|
|
$hooks->trigger(HOOK_INIT);
|
|
|
|
$io = new SymfonyStyle($input, $output);
|
|
|
|
if (!clearCache()) {
|
|
$io->error('Unknown error on clear cache');
|
|
return Command::FAILURE;
|
|
}
|
|
|
|
$io->success('Cache cleared');
|
|
return Command::SUCCESS;
|
|
}
|
|
}
|