Remove the backup deteciton code which was used for server < 9.1
authorOlivier Goffart <ogoffart@woboq.com>
Tue, 16 Oct 2018 14:08:49 +0000 (16:08 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:10 +0000 (10:58 +0100)
src/gui/folder.cpp
src/gui/folder.h
src/libsync/syncengine.cpp
src/libsync/syncengine.h

index 73da3162adb8dbca23d195462f66538fc2833f16..28c248cef8c99a84c2de5830ec041093a6b62d32 100644 (file)
@@ -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));
index 734d709ab7036e929d57895c08308c4f4588c20c..bd659ba7ee2b87cefa564014ab9f404a652598ad 100644 (file)
@@ -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
index bf2afca5cf8ce27803e5066bc50b9365030dff24..750ef9e3cf24a5880b3bb24e021d5507128e1333 100644 (file)
@@ -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();
index ac41798ac66f85c22dfd54ae27e8187f27cfadfc..3715d1c0f9020f5da9481c9ba0c7d36270ed1370 100644 (file)
@@ -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;