diff --git a/config/config.sample.php b/config/config.sample.php index 37383addea277..1b176ca48705f 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -982,6 +982,14 @@ */ 'updater.release.channel' => 'stable', + /** + * Does Nextcloud needs to cleanup old backups after an update has been + * performed? + * + * Defaults to ``true`` + */ + 'updater.cleanup_backups' => true, + /** * Is Nextcloud connected to the Internet or running in a closed network? * diff --git a/lib/private/Repair/AddCleanupUpdaterBackupsJob.php b/lib/private/Repair/AddCleanupUpdaterBackupsJob.php index 731bf4537c710..6f53fa8acbccc 100644 --- a/lib/private/Repair/AddCleanupUpdaterBackupsJob.php +++ b/lib/private/Repair/AddCleanupUpdaterBackupsJob.php @@ -10,12 +10,14 @@ use OC\Core\BackgroundJobs\BackgroundCleanupUpdaterBackupsJob; use OCP\BackgroundJob\IJobList; +use OCP\IConfig; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; class AddCleanupUpdaterBackupsJob implements IRepairStep { public function __construct( protected readonly IJobList $jobList, + protected readonly IConfig $config, ) { } @@ -24,6 +26,8 @@ public function getName(): string { } public function run(IOutput $output): void { - $this->jobList->add(BackgroundCleanupUpdaterBackupsJob::class); + if ($this->config->getSystemValueBool('updater.cleanup_backups', true)) { + $this->jobList->add(BackgroundCleanupUpdaterBackupsJob::class); + } } }