From 9f5da4f8fa49ad1896e0045aa79e3f3993402e5b Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 18 Mar 2026 18:03:23 +0100 Subject: [PATCH] feat(updater): add a config toggle to disable adding the BackgroundCleanupUpdaterBackupsJob Since the updater can be used with --no-backup, which doesn't create the backups folder in the first place, it isn't required to make this check, which sends a warning-level log if it doesn't find the folder. Signed-off-by: Thomas Citharel --- config/config.sample.php | 8 ++++++++ lib/private/Repair/AddCleanupUpdaterBackupsJob.php | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) 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); + } } }