csync_vio_local_closedir(dh);
}
_hasLocalEntries = true;
+ // Process is being called when both local and server entries are fetched.
if (_hasServerEntries)
process();
}
if (recurseQueryServer != ParentNotChanged && !serverEntry.isValid())
recurseQueryServer = ParentDontExist;
+ bool noServerEntry = _queryServer != ParentNotChanged && !serverEntry.isValid();
+
if (_queryServer == NormalQuery && serverEntry.isValid()) {
item->_checksumHeader = serverEntry.checksumHeader;
item->_fileId = serverEntry.fileId;
item->_type = ItemTypeVirtualFile;
}
- if (_queryServer != ParentNotChanged && !serverEntry.isValid()) {
+ if (noServerEntry) {
item->_instruction = CSYNC_INSTRUCTION_REMOVE;
item->_direction = SyncFileItem::Down;
}
} else if (dbEntry.isValid() && !typeChange && ((dbEntry._modtime == localEntry.modtime && dbEntry._fileSize == localEntry.size) || (localEntry.isDirectory && dbEntry._type == ItemTypeDirectory))) {
// Local file unchanged.
- if (_queryServer != ParentNotChanged && !serverEntry.isValid()) {
+ if (noServerEntry) {
item->_instruction = CSYNC_INSTRUCTION_REMOVE;
item->_direction = SyncFileItem::Down;
} else if (!serverModified && dbEntry._inode != localEntry.inode) {
}
qCInfo(lcDisco) << "Discovered" << item->_file << item->_instruction << item->_direction << item->isDirectory();
- bool recurse = checkPremission(item);
+ bool recurse = checkPermissions(item);
if (recurse && item->isDirectory()) {
auto job = new ProcessDirectoryJob(item, recurseQueryServer, NormalQuery, _discoveryData, this);
job->_currentFolder = path;
}
} else {
item->_instruction = CSYNC_INSTRUCTION_SYNC;
- if (_queryServer != ParentNotChanged && !serverEntry.isValid()) {
+ if (noServerEntry) {
// Special case! deleted on server, modified on client, the instruction is then NEW
item->_instruction = CSYNC_INSTRUCTION_NEW;
}
}
}
} else if (_queryLocal == ParentNotChanged && dbEntry.isValid()) {
- if (_queryServer != ParentNotChanged && !serverEntry.isValid()) {
+ if (noServerEntry) {
// Not modified locally (ParentNotChanged), bit not on the server: Removed on the server.
item->_instruction = CSYNC_INSTRUCTION_REMOVE;
item->_direction = SyncFileItem::Down;
}
- } else if (_queryServer != ParentNotChanged && !serverEntry.isValid()) {
+ } else if (noServerEntry) {
// Not locally, not on the server. The entry is stale!
qCInfo(lcDisco) << "Stale DB entry";
return;
bool recurse = item->isDirectory() || localEntry.isDirectory || serverEntry.isDirectory;
- if (!checkPremission(item))
+ if (!checkPermissions(item))
recurse = false;
if (_queryLocal != NormalQuery && _queryServer != NormalQuery && !item->_isRestoration)
recurse = false;
}
}
-bool ProcessDirectoryJob::checkPremission(const OCC::SyncFileItemPtr &item)
+bool ProcessDirectoryJob::checkPermissions(const OCC::SyncFileItemPtr &item)
{
if (item->_direction != SyncFileItem::Up) {
// Currently we only check server-side permissions
public:
enum QueryMode {
NormalQuery,
- ParentDontExist,
- ParentNotChanged,
- InBlackList
+ ParentDontExist, // Do not query this folder because it does not exist
+ ParentNotChanged, // No need to query this folder because it has not changed from what is in the DB
+ InBlackList // Do not query this folder because it is in th blacklist (remote entries only)
};
Q_ENUM(QueryMode)
explicit ProcessDirectoryJob(const SyncFileItemPtr &dirItem, QueryMode queryServer, QueryMode queryLocal,
bool handleExcluded(const QString &path, bool isDirectory, bool isHidden, bool isSymlink);
void processFile(PathTuple, const LocalInfo &, const RemoteInfo &, const SyncJournalFileRecord &dbEntry);
// Return false if there is an error and that a directory must not be recursively be taken
- bool checkPremission(const SyncFileItemPtr &item);
+ bool checkPermissions(const SyncFileItemPtr &item);
void processBlacklisted(const PathTuple &, const LocalInfo &, const SyncJournalFileRecord &dbEntry);
void subJobFinished();
void progress();