myaac/system/src/Commands/CacheClearCommand.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;
}
}