From b86e1efc9a1329d10687162e21a1bed3636dde57 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 16 Oct 2018 16:08:49 +0200 Subject: [PATCH] Remove the backup deteciton code which was used for server < 9.1 --- src/gui/folder.cpp | 24 ------------------------ src/gui/folder.h | 2 -- src/libsync/syncengine.cpp | 16 ---------------- src/libsync/syncengine.h | 12 ------------ 4 files changed, 54 deletions(-) diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 73da3162a..28c248cef 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -93,8 +93,6 @@ Folder::Folder(const FolderDefinition &definition, //direct connection so the message box is blocking the sync. connect(_engine.data(), &SyncEngine::aboutToRemoveAllFiles, this, &Folder::slotAboutToRemoveAllFiles); - connect(_engine.data(), &SyncEngine::aboutToRestoreBackup, - this, &Folder::slotAboutToRestoreBackup); connect(_engine.data(), &SyncEngine::transmissionProgress, this, &Folder::slotTransmissionProgress); connect(_engine.data(), &SyncEngine::itemCompleted, this, &Folder::slotItemCompleted); @@ -1098,28 +1096,6 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction dir, bool *cancel } } -void Folder::slotAboutToRestoreBackup(bool *restore) -{ - QString msg = - tr("This sync would reset the files to an earlier time in the sync folder '%1'.\n" - "This might be because a backup was restored on the server.\n" - "Continuing the sync as normal will cause all your files to be overwritten by an older " - "file in an earlier state. " - "Do you want to keep your local most recent files as conflict files?"); - QMessageBox msgBox(QMessageBox::Warning, tr("Backup detected"), - msg.arg(shortGuiLocalPath())); - msgBox.setWindowFlags(msgBox.windowFlags() | Qt::WindowStaysOnTopHint); - msgBox.addButton(tr("Normal Synchronisation"), QMessageBox::DestructiveRole); - QPushButton *keepBtn = msgBox.addButton(tr("Keep Local Files as Conflict"), QMessageBox::AcceptRole); - - if (msgBox.exec() == -1) { - *restore = true; - return; - } - *restore = msgBox.clickedButton() == keepBtn; -} - - void FolderDefinition::save(QSettings &settings, const FolderDefinition &folder) { settings.beginGroup(FolderMan::escapeAlias(folder.alias)); diff --git a/src/gui/folder.h b/src/gui/folder.h index 734d709ab..bd659ba7e 100644 --- a/src/gui/folder.h +++ b/src/gui/folder.h @@ -261,8 +261,6 @@ public slots: // connected to the corresponding signals in the SyncEngine void slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *); - void slotAboutToRestoreBackup(bool *); - /** * Starts a sync operation diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index bf2afca5c..750ef9e3c 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -73,8 +73,6 @@ SyncEngine::SyncEngine(AccountPtr account, const QString &localPath, , _progressInfo(new ProgressInfo) , _hasNoneFiles(false) , _hasRemoveFile(false) - , _hasForwardInTimeFiles(false) - , _backInTimeFiles(0) , _uploadLimit(0) , _downloadLimit(0) , _anotherSyncNeeded(NoFollowUpSync) @@ -360,18 +358,6 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item) // An upload of an existing file means that the file was left unchanged on the server // This counts as a NONE for detecting if all the files on the server were changed _hasNoneFiles = true; - } else if (!item->isDirectory()) { - auto difftime = std::difftime(item->_modtime, item->_previousModtime); - if (difftime < -3600 * 2) { - // We are going back on time - // We only increment if the difference is more than two hours to avoid clock skew - // issues or DST changes. (We simply ignore files that goes in the past less than - // two hours for the backup detection heuristics.) - _backInTimeFiles++; - qCWarning(lcEngine) << item->_file << "has a timestamp earlier than the local file"; - } else if (difftime > 0) { - _hasForwardInTimeFiles = true; - } } } @@ -414,8 +400,6 @@ void SyncEngine::startSync() _hasNoneFiles = false; _hasRemoveFile = false; - _hasForwardInTimeFiles = false; - _backInTimeFiles = 0; _seenFiles.clear(); _progressInfo->reset(); diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h index ac41798ac..3715d1c0f 100644 --- a/src/libsync/syncengine.h +++ b/src/libsync/syncengine.h @@ -145,12 +145,6 @@ signals: * Set *cancel to true in a slot connected from this signal to abort the sync. */ void aboutToRemoveAllFiles(SyncFileItem::Direction direction, bool *cancel); - /** - * Emited when the sync engine detects that all the files are changed to dates in the past. - * This usually happen when a backup was restored on the server from an earlier date. - * Set *restore to true in a slot connected from this signal to re-upload all files. - */ - void aboutToRestoreBackup(bool *restore); // A new folder was discovered and was not synced because of the confirmation feature void newBigFolder(const QString &folder, bool isExternal); @@ -258,12 +252,6 @@ private: // true if there is at leasr one file with instruction REMOVE bool _hasRemoveFile; - // true if there is at least one file from the server that goes forward in time - bool _hasForwardInTimeFiles; - - // number of files which goes back in time from the server - int _backInTimeFiles; - // If ignored files should be ignored bool _ignore_hidden_files = false;