From 5927fd34e3b480d1cd89c3ca41b1a05329bc7d78 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Wed, 28 Aug 2024 17:14:57 +1200 Subject: [PATCH] API Update API to reflect changes to CLI interaction --- _config/migration.yml | 4 ++-- .../InterventionBackendCacheFlushTask.php | 18 ++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/_config/migration.yml b/_config/migration.yml index 0e290c3e..e4f1461d 100644 --- a/_config/migration.yml +++ b/_config/migration.yml @@ -1,11 +1,11 @@ --- Name: file-migration --- -# Remove the HTTPOutputHandler from the logger on the file migration. +# Remove the ErrorOutputHandler from the logger on the file migration. # It logs a lot of >= NOTICE errors that pollute the output with backtrace. SilverStripe\Core\Injector\Injector: Psr\Log\LoggerInterface.quiet: type: singleton class: Monolog\Logger constructor: - - "file-migration" \ No newline at end of file + - "file-migration" diff --git a/src/Dev/Tasks/InterventionBackendCacheFlushTask.php b/src/Dev/Tasks/InterventionBackendCacheFlushTask.php index edbc67d9..2e792b8d 100644 --- a/src/Dev/Tasks/InterventionBackendCacheFlushTask.php +++ b/src/Dev/Tasks/InterventionBackendCacheFlushTask.php @@ -4,27 +4,25 @@ use SilverStripe\Assets\InterventionBackend; use SilverStripe\Dev\BuildTask; +use SilverStripe\PolyExecution\PolyOutput; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputInterface; /** * A task to manually flush InterventionBackend cache */ class InterventionBackendCacheFlushTask extends BuildTask { - private static $segment = 'InterventionBackendCacheFlushTask'; + protected static string $commandName = 'InterventionBackendCacheFlushTask'; - protected $title = 'Clear InterventionBackend cache'; + protected string $title = 'Clear InterventionBackend cache'; - protected $description = "Clears caches for InterventionBackend"; + protected static string $description = 'Clears caches for InterventionBackend'; - /** - * @param \SilverStripe\Control\HTTPRequest $request - * @throws \ReflectionException - */ - public function run($request) + protected function execute(InputInterface $input, PolyOutput $output): int { $class = new InterventionBackend(); $class->getCache()->clear(); - - echo 'DONE'; + return Command::SUCCESS; } }