Upload beautify
This commit is contained in:
25
app/Uploads/Commands/CleanupUploadsCommand.php
Normal file
25
app/Uploads/Commands/CleanupUploadsCommand.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Uploads\Commands;
|
||||
|
||||
use App\Uploads\Services\CleanupService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
final class CleanupUploadsCommand extends Command
|
||||
{
|
||||
protected $signature = 'uploads:cleanup {--limit=100 : Maximum drafts to clean in one run}';
|
||||
|
||||
protected $description = 'Delete stale draft uploads and their temporary directories';
|
||||
|
||||
public function handle(CleanupService $cleanupService): int
|
||||
{
|
||||
$limit = (int) $this->option('limit');
|
||||
$deleted = $cleanupService->cleanupStaleDrafts($limit);
|
||||
|
||||
$this->info("Uploads cleanup deleted {$deleted} draft(s).");
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user