Add warning about APCu clear in CLI

Adds a warning message if attempting to clear APCu cache from the CLI, as this is not supported. Users are advised to use the Admin Panel for clearing APCu cache outside of development environments.
This commit is contained in:
slawkens
2025-07-19 11:16:03 +02:00
parent 34fead906e
commit 83f84172e0

View File

@@ -2,6 +2,7 @@
namespace MyAAC\Commands;
use MyAAC\Cache\Cache;
use MyAAC\Hooks;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -26,6 +27,15 @@ class CacheClearCommand extends Command
return Command::FAILURE;
}
$cache = Cache::getInstance();
$cacheEngine = config('cache_engine') == 'auto' ?
Cache::detect() : config('cache_engine');
if (config('env') !== 'dev' && $cacheEngine == 'apcu') {
$io->warning('APCu cache cannot be cleared in CLI. Please visit the Admin Panel and clear there.');
}
$io->success('Cache cleared');
return Command::SUCCESS;
}