[Pkg-owncloud-commits] [owncloud-client] 129/332: csync_update: update the permission in the db when they change
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu Aug 14 21:06:50 UTC 2014
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 8de3bda0b1f900ab183698454740fd979f7ab9d7
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Tue Jun 24 11:08:38 2014 +0200
csync_update: update the permission in the db when they change
The current code only update the permissions in the DB when
the permission becomes non-empty.
Now we update the permission each time they change.
That way the code is the same for file id and permission so it is
simpler.
---
csync/src/csync_update.c | 26 +++++++-------------------
1 file changed, 7 insertions(+), 19 deletions(-)
diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c
index cd14d43..c2a5891 100644
--- a/csync/src/csync_update.c
+++ b/csync/src/csync_update.c
@@ -254,32 +254,20 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
st->instruction = CSYNC_INSTRUCTION_EVAL;
goto out;
}
+ bool metadata_differ = ctx->current == REMOTE_REPLICA && (!c_streq(fs->file_id, tmp->file_id)
+ || !c_streq(fs->remotePerm, tmp->remotePerm));
if (type == CSYNC_FTW_TYPE_DIR && ctx->current == REMOTE_REPLICA
- && c_streq(fs->file_id, tmp->file_id) && !ctx->read_from_db_disabled) {
+ && !metadata_differ && !ctx->read_from_db_disabled) {
/* If both etag and file id are equal for a directory, read all contents from
* the database.
- * The comparison of file id ensure that we fetch all the file id when upgrading from
- * owncloud 5 to owncloud 6.
+ * The metadata comparison ensure that we fetch all the file id or permission when
+ * upgrading owncloud
*/
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Reading from database: %s", path);
ctx->remote.read_from_db = true;
}
- if (ctx->current == REMOTE_REPLICA
- // DB perm; true for NULL or empty (on update)
- && strlen(tmp->remotePerm) == 0
- // remote perm (even if remote perm empty it will be ' ' see fill_webdav_properties_into_resource
- && strlen(fs->remotePerm) > 0)
- {
- /* remotePerm received from server but none in DB.
- * Which means we need to update the DB.
- * (upgrade from owncloud x to owncloud 7 for instence) */
- st->should_update_etag = true; // write to DB after PROPFIND
- ctx->remote.read_from_db = false; // get dirs via PROPFIND
-
- }
- if (!c_streq(fs->file_id, tmp->file_id) && ctx->current == REMOTE_REPLICA) {
- /* file id has changed. Which means we need to update the DB.
- * (upgrade from owncloud 5 to owncloud 6 for instence) */
+ if (metadata_differ) {
+ /* file id or permissions has changed. Which means we need to update them in the DB. */
st->should_update_etag = true;
}
st->instruction = CSYNC_INSTRUCTION_NONE;
--
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