mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 06:55:59 +03:00
Merge pull request #2188 from nextcloud/upgrade-syncjournaldb-to27
Move existing syncjournal db files from client ver <2.7
This commit is contained in:
commit
62e2f64165
1 changed files with 18 additions and 4 deletions
|
@ -218,13 +218,27 @@ void FolderMan::setupFoldersHelper(QSettings &settings, AccountStatePtr account,
|
|||
socketApi()->slotUnregisterPath(folderAlias);
|
||||
auto settings = account->settings();
|
||||
|
||||
auto journalFileMoveSuccess = true;
|
||||
// Due to db logic can't be sure which of these file exist.
|
||||
if (oldJournal.exists()) {
|
||||
journalFileMoveSuccess &= oldJournal.rename(folderDefinition.journalPath);
|
||||
}
|
||||
if (oldJournalShm.exists()) {
|
||||
journalFileMoveSuccess &= oldJournalShm.rename(folderDefinition.journalPath.append("-shm"));
|
||||
}
|
||||
if (oldJournalWal.exists()) {
|
||||
journalFileMoveSuccess &= oldJournalWal.rename(folderDefinition.journalPath.append("-wal"));
|
||||
}
|
||||
|
||||
if (!journalFileMoveSuccess) {
|
||||
qCWarning(lcFolderMan) << "Wasn't able to move pre-2.7 syncjournal database files to new location. One-time loss off sync settings possible.";
|
||||
} else {
|
||||
qCInfo(lcFolderMan) << "Successfully migrated syncjournal database.";
|
||||
}
|
||||
|
||||
Folder *f = addFolderInternal(folderDefinition, account.data());
|
||||
f->saveToSettings();
|
||||
|
||||
oldJournal.remove();
|
||||
oldJournalShm.remove();
|
||||
oldJournalWal.remove();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue