Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-09-15 16:34:33 +0300
committerGitHub <noreply@github.com>2021-09-15 16:34:33 +0300
commit9c4058ac39f02291641a102fa8ab0c977bb4d6a2 (patch)
tree0ca37894101f03b2203511f925547c20cd960bcd /src/gui/folderman.cpp
parent9a27cc7b519eecf11b10c3f12c2a5080fc095c0f (diff)
Migrate existing db files and save their journal path (#9028)
Fixes: #9019
Diffstat (limited to 'src/gui/folderman.cpp')
-rw-r--r--src/gui/folderman.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index e2be3531f..bfdcfc29d 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -286,7 +286,16 @@ void FolderMan::setupFoldersHelper(QSettings &settings, AccountStatePtr account,
FolderDefinition folderDefinition;
settings.beginGroup(folderAlias);
if (FolderDefinition::load(settings, folderAlias, &folderDefinition)) {
- auto defaultJournalPath = folderDefinition.defaultJournalPath(account->account());
+ const auto defaultJournalPath = [&account, folderDefinition] {
+ // if we would have booth the 2.9.0 file name and the lagacy file
+ // with the md5 infix we prefer the 2.9.0 version
+ const auto path = SyncJournalDb::makeDbName(folderDefinition.localPath);
+ if (QFileInfo::exists(QDir(folderDefinition.localPath).filePath(path))) {
+ return path;
+ }
+ // legacy name
+ return SyncJournalDb::makeDbName(folderDefinition.localPath, account->account()->url(), folderDefinition.targetPath, account->account()->credentials()->user());
+ }();
// Migration: Old settings don't have journalPath
if (folderDefinition.journalPath.isEmpty()) {
@@ -329,6 +338,9 @@ void FolderMan::setupFoldersHelper(QSettings &settings, AccountStatePtr account,
if (foldersWithPlaceholders)
f->setSaveInFoldersWithPlaceholders();
+ // save possible changes from the migration
+ f->saveToSettings();
+
scheduleFolder(f);
emit folderSyncStateChange(f);
}
@@ -1011,7 +1023,7 @@ Folder *FolderMan::addFolder(AccountState *accountState, const FolderDefinition
{
// Choose a db filename
auto definition = folderDefinition;
- definition.journalPath = definition.defaultJournalPath(accountState->account());
+ definition.journalPath = SyncJournalDb::makeDbName(folderDefinition.localPath);
if (!ensureJournalGone(definition.absoluteJournalPath())) {
return nullptr;