From d35d7d23600b2ea2478924e297a70cac64ef62ea Mon Sep 17 00:00:00 2001 From: tomasz1986 Date: Tue, 8 Feb 2022 07:06:14 +0100 Subject: [PATCH] lib, gui: Removed unused cleanInterval from Staggered Versioning (ref #541) (#8161) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Staggered File Versioning used to have its own cleanInterval that controlled how often file versions were cleaned. Nowadays, there is a seperate setting called cleanupIntervalS responsible for the cleanup, which applies to all File Versioning (except External). Thus, remove the unneeded code and don't set the param up on new folders anymore. Signed-off-by: Tomasz WilczyƄski --- gui/default/syncthing/core/syncthingController.js | 3 --- lib/config/config.go | 2 +- lib/config/migrations.go | 7 +++++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index eee4e1334..99bc22295 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -74,7 +74,6 @@ angular.module('syncthing.core') cleanupIntervalS: 3600, simpleKeep: 5, staggeredMaxAge: 365, - staggeredCleanInterval: 3600, externalCommand: "", }; @@ -2071,7 +2070,6 @@ angular.module('syncthing.core') break; case "staggered": $scope.currentFolder._guiVersioning.staggeredMaxAge = Math.floor(+currentVersioning.params.maxAge / 86400); - $scope.currentFolder._guiVersioning.staggeredCleanInterval = +currentVersioning.params.cleanInterval; break; case "external": $scope.currentFolder._guiVersioning.externalCommand = currentVersioning.params.command; @@ -2256,7 +2254,6 @@ angular.module('syncthing.core') break; case "staggered": folderCfg.versioning.params.maxAge = '' + (folderCfg._guiVersioning.staggeredMaxAge * 86400); - folderCfg.versioning.params.cleanInterval = '' + folderCfg._guiVersioning.staggeredCleanInterval; break; case "external": folderCfg.versioning.params.command = '' + folderCfg._guiVersioning.externalCommand; diff --git a/lib/config/config.go b/lib/config/config.go index 1ad68304d..43e6f25de 100644 --- a/lib/config/config.go +++ b/lib/config/config.go @@ -29,7 +29,7 @@ import ( const ( OldestHandledVersion = 10 - CurrentVersion = 35 + CurrentVersion = 36 MaxRescanIntervalS = 365 * 24 * 60 * 60 ) diff --git a/lib/config/migrations.go b/lib/config/migrations.go index 51512d924..f018d936f 100644 --- a/lib/config/migrations.go +++ b/lib/config/migrations.go @@ -27,6 +27,7 @@ import ( // put the newest on top for readability. var ( migrations = migrationSet{ + {36, migrateToConfigV36}, {35, migrateToConfigV35}, {34, migrateToConfigV34}, {33, migrateToConfigV33}, @@ -94,6 +95,12 @@ func (m migration) apply(cfg *Configuration) { cfg.Version = m.targetVersion } +func migrateToConfigV36(cfg *Configuration) { + for i := range cfg.Folders { + delete(cfg.Folders[i].Versioning.Params, "cleanInterval") + } +} + func migrateToConfigV35(cfg *Configuration) { for i, fcfg := range cfg.Folders { params := fcfg.Versioning.Params