Skip to content

Commit 9f5da4f

Browse files
committed
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 <tcit@tcit.fr>
1 parent 35606bc commit 9f5da4f

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

config/config.sample.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,14 @@
982982
*/
983983
'updater.release.channel' => 'stable',
984984

985+
/**
986+
* Does Nextcloud needs to cleanup old backups after an update has been
987+
* performed?
988+
*
989+
* Defaults to ``true``
990+
*/
991+
'updater.cleanup_backups' => true,
992+
985993
/**
986994
* Is Nextcloud connected to the Internet or running in a closed network?
987995
*

lib/private/Repair/AddCleanupUpdaterBackupsJob.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010

1111
use OC\Core\BackgroundJobs\BackgroundCleanupUpdaterBackupsJob;
1212
use OCP\BackgroundJob\IJobList;
13+
use OCP\IConfig;
1314
use OCP\Migration\IOutput;
1415
use OCP\Migration\IRepairStep;
1516

1617
class AddCleanupUpdaterBackupsJob implements IRepairStep {
1718
public function __construct(
1819
protected readonly IJobList $jobList,
20+
protected readonly IConfig $config,
1921
) {
2022
}
2123

@@ -24,6 +26,8 @@ public function getName(): string {
2426
}
2527

2628
public function run(IOutput $output): void {
27-
$this->jobList->add(BackgroundCleanupUpdaterBackupsJob::class);
29+
if ($this->config->getSystemValueBool('updater.cleanup_backups', true)) {
30+
$this->jobList->add(BackgroundCleanupUpdaterBackupsJob::class);
31+
}
2832
}
2933
}

0 commit comments

Comments
 (0)