Add rcc command
continuous-integration/drone/push Build is passing Details

This commit is contained in:
philipp lang 2024-09-28 01:31:05 +02:00
parent eee6b86e15
commit 9f787646c4
3 changed files with 60 additions and 7 deletions

View File

@ -4,6 +4,7 @@ namespace Aweos\Resizer;
use Aweos\Resizer\Classes\CacheManager; use Aweos\Resizer\Classes\CacheManager;
use Aweos\Resizer\Classes\ImageResizer; use Aweos\Resizer\Classes\ImageResizer;
use Aweos\Resizer\Console\ResizeCacheClear;
use Aweos\Resizer\Console\ResizeMake; use Aweos\Resizer\Console\ResizeMake;
use Aweos\Resizer\Console\ResizePurge; use Aweos\Resizer\Console\ResizePurge;
use Aweos\Resizer\Jobs\DeleteJob; use Aweos\Resizer\Jobs\DeleteJob;
@ -47,6 +48,7 @@ class Plugin extends PluginBase
{ {
$this->registerConsoleCommand('resizer.resizemake', ResizeMake::class); $this->registerConsoleCommand('resizer.resizemake', ResizeMake::class);
$this->registerConsoleCommand('resizer.resizepurge', ResizePurge::class); $this->registerConsoleCommand('resizer.resizepurge', ResizePurge::class);
$this->registerConsoleCommand('resizer.resize-cache-clear', ResizeCacheClear::class);
} }
/** /**

View File

@ -56,5 +56,4 @@ class CacheManager
return $this->tagGenerator->singleFile($path, $size); return $this->tagGenerator->singleFile($path, $size);
} }
} }

View File

@ -0,0 +1,52 @@
<?php
namespace Aweos\Resizer\Console;
use Aweos\Resizer\Classes\CacheManager;
use Aweos\Resizer\Lib\StorageMediaPath;
use Illuminate\Console\Command;
use Storage;
use Symfony\Component\Console\Input\InputArgument;
class ResizeCacheClear extends Command
{
/**
* @var string The console command name.
*/
protected $name = 'rcc';
/**
* @var string The console command description.
*/
protected $description = 'Clears cache for a specific file';
/**
* Execute the console command.
* @return void
*/
public function handle()
{
$path = new StorageMediaPath($this->argument('path'));
app(CacheManager::class)->delete($path);
}
/**
* Get the console command arguments.
* @return array
*/
protected function getArguments()
{
return [
['path', InputArgument::REQUIRED, 'The path on the storage'],
];
}
/**
* Get the console command options.
* @return array
*/
protected function getOptions()
{
return [];
}
}