1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-06 13:16:45 +02:00

feat(console): use Thermage for CacheClearCommand and improve logic

This commit is contained in:
Awilum
2022-04-19 17:04:39 +03:00
parent 23fb2a59e9
commit e5b51b614c

View File

@@ -44,12 +44,30 @@ class CacheClearCommand extends Command
if ($input->getOption('data')) {
if (filesystem()->directory(PATH['tmp'] . '/data')->exists()) {
if (filesystem()->directory(PATH['tmp'] . '/data')->delete()) {
$io->success('Data were successfully cleared from the cache.');
$output->write(
renderToString(
div('Success: Data were successfully cleared from the cache.',
'bg-success px-2 py-1')
)
);
$result = Command::SUCCESS;
} else {
$io->error('Data cache wasn\'t cleared.');
$output->write(
renderToString(
div('Failure: Data cache wasn\'t cleared.',
'bg-danger px-2 py-1')
)
);
$result = Command::FAILURE;
}
} else {
$output->write(
renderToString(
div('Failure: Data cache directory ' . PATH['tmp'] . '/data' . ' doesn\'t exist.',
'bg-danger px-2 py-1')
)
);
$result = Command::FAILURE;
}
}