[Pkg-owncloud-commits] [owncloud-client] 290/484: CleanupPollsJobs: Preserve more journal data

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:54 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 8f7dbe71a139d4e3f6205a836e037ff58dd2d108
Author: Christian Kamm <mail at ckamm.de>
Date:   Tue Nov 10 14:26:25 2015 +0100

    CleanupPollsJobs: Preserve more journal data
---
 src/libsync/owncloudpropagator.cpp    |  5 ++---
 src/libsync/syncjournalfilerecord.cpp | 18 ++++++++++++++++++
 src/libsync/syncjournalfilerecord.h   |  9 +++++++++
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp
index c123adf..bd4f37b 100644
--- a/src/libsync/owncloudpropagator.cpp
+++ b/src/libsync/owncloudpropagator.cpp
@@ -664,9 +664,8 @@ void CleanupPollsJob::start()
 
     auto info = _pollInfos.first();
     _pollInfos.pop_front();
-    SyncFileItemPtr item(new SyncFileItem);
-    item->_file = info._file;
-    item->_modtime = info._modtime;
+    SyncFileItemPtr item(new SyncFileItem(
+            _journal->getFileRecord(info._file).toSyncFileItem()));
     PollJob *job = new PollJob(_account, info._url, item, _journal, _localPath, this);
     connect(job, SIGNAL(finishedSignal()), SLOT(slotPollFinished()));
     job->start();
diff --git a/src/libsync/syncjournalfilerecord.cpp b/src/libsync/syncjournalfilerecord.cpp
index 4fff0a7..07d5f7c 100644
--- a/src/libsync/syncjournalfilerecord.cpp
+++ b/src/libsync/syncjournalfilerecord.cpp
@@ -85,6 +85,24 @@ SyncJournalFileRecord::SyncJournalFileRecord(const SyncFileItem &item, const QSt
 
 }
 
+SyncFileItem SyncJournalFileRecord::toSyncFileItem()
+{
+    SyncFileItem item;
+    item._file = _path;
+    item._inode = _inode;
+    item._modtime = Utility::qDateTimeToTime_t(_modtime);
+    item._type = static_cast<SyncFileItem::Type>(_type);
+    item._etag = _etag;
+    item._fileId = _fileId;
+    item._size = _fileSize;
+    item._remotePerm = _remotePerm;
+    // item has no _mode
+    item._serverHasIgnoredFiles = _serverHasIgnoredFiles;
+    item._transmissionChecksum = _transmissionChecksum;
+    item._transmissionChecksumType = _transmissionChecksumType;
+    return item;
+}
+
 static time_t getMinBlacklistTime()
 {
     return qMax(qgetenv("OWNCLOUD_BLACKLIST_TIME_MIN").toInt(),
diff --git a/src/libsync/syncjournalfilerecord.h b/src/libsync/syncjournalfilerecord.h
index 4165caf..d8282ec 100644
--- a/src/libsync/syncjournalfilerecord.h
+++ b/src/libsync/syncjournalfilerecord.h
@@ -31,8 +31,17 @@ class OWNCLOUDSYNC_EXPORT SyncJournalFileRecord
 {
 public:
     SyncJournalFileRecord();
+
+    /// Creates a record from an existing item while updating the inode
     SyncJournalFileRecord(const SyncFileItem&, const QString &localFileName);
 
+    /** Creates a basic SyncFileItem from the record
+     *
+     * This is intended in particular for read-update-write cycles that need
+     * to go through a a SyncFileItem, like PollJob.
+     */
+    SyncFileItem toSyncFileItem();
+
     bool isValid() {
         return !_path.isEmpty();
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list