From f7b7e4a2ab9b18a4fa26d749c3808a857e93a9c6 Mon Sep 17 00:00:00 2001 From: buzkall Date: Mon, 16 Jun 2025 12:39:10 +0200 Subject: [PATCH] Add option to reload configuration in CleanupCommand Allow it to run in a multi tenant environment --- src/Commands/CleanupCommand.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Commands/CleanupCommand.php b/src/Commands/CleanupCommand.php index be4b5332..f33499a5 100644 --- a/src/Commands/CleanupCommand.php +++ b/src/Commands/CleanupCommand.php @@ -16,7 +16,7 @@ class CleanupCommand extends BaseCommand implements Isolatable use Retryable; /** @var string */ - protected $signature = 'backup:clean {--disable-notifications} {--tries=}'; + protected $signature = 'backup:clean {--disable-notifications} {--tries=} {--reload-config}'; /** @var string */ protected $description = 'Remove all backups older than specified number of days in config.'; @@ -37,6 +37,9 @@ public function handle(): int $this->setTries('cleanup'); try { + if ($this->option('reload-config')) { + $this->config = Config::fromArray(config('backup')); + } $backupDestinations = BackupDestinationFactory::createFromArray($this->config); $cleanupJob = new CleanupJob($backupDestinations, $this->strategy, $disableNotifications);