CleanupPollsJobs: Preserve more journal data

This commit is contained in:
Christian Kamm 2015-11-10 14:26:25 +01:00
parent 4b5c3d8f09
commit 8f7dbe71a1
3 changed files with 29 additions and 3 deletions

View file

@ -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();

View file

@ -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(),

View file

@ -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();
}