diff --git a/config/config.sample.php b/config/config.sample.php index 598ed49f6f943..722a2caa7d83b 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -1050,6 +1050,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 c0e139b1df8fa..98324c0a08afe 100644 --- a/lib/private/Repair/AddCleanupUpdaterBackupsJob.php +++ b/lib/private/Repair/AddCleanupUpdaterBackupsJob.php @@ -11,12 +11,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, ) { } @@ -27,6 +29,8 @@ public function getName(): string { #[\Override] public function run(IOutput $output): void { - $this->jobList->add(BackgroundCleanupUpdaterBackupsJob::class); + if ($this->config->getSystemValueBool('updater.cleanup_backups', true)) { + $this->jobList->add(BackgroundCleanupUpdaterBackupsJob::class); + } } }