mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-11-27 18:10:42 +00:00
ask before clearing the cache
This commit is contained in:
parent
994fe49e6d
commit
7c9ef030d6
|
|
@ -6,6 +6,8 @@ use Symfony\Component\Console\Input\InputInterface;
|
|||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Helper\QuestionHelper;
|
||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
|
||||
use Seeddms\Seeddms\Settings;
|
||||
use Seeddms\Seeddms\Translator;
|
||||
|
|
@ -33,9 +35,10 @@ class ClearcacheCommand extends Command
|
|||
protected function configure()
|
||||
{
|
||||
$this->setName('cache:clear')
|
||||
->setDescription('Clears the cache')
|
||||
->setHelp('Clears all cache or those specified.')
|
||||
->addOption('cache', '', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Remove files from cache.', null)
|
||||
->setDescription('Clear cache')
|
||||
->setHelp('Clears either all caches or those specified with option --cache. Think twice before you clear a cache with previews. Depending on the number of documents in your DMS, it may take a long time to recreate the cache.')
|
||||
->addOption('cache', '', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Remove files from this cache.', null)
|
||||
->addOption('force', '', InputOption::VALUE_NONE, 'Force operation, do not ask')
|
||||
;
|
||||
}
|
||||
|
||||
|
|
@ -52,6 +55,14 @@ class ClearcacheCommand extends Command
|
|||
return Command::FAILURE;
|
||||
}
|
||||
|
||||
if (!$input->getOption('force')) {
|
||||
$helper = new QuestionHelper();
|
||||
$question = new ConfirmationQuestion('Do you really want to clear the cache? ', false);
|
||||
if (!$helper->ask($input, $output, $question)) {
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
require_once('inc/inc.DBInit.php');
|
||||
|
||||
$post = array_flip($input->getOption('cache'));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user