[Pkg-owncloud-commits] [owncloud] 97/273: Use the etag to check for updates in webdav storages where available

David Prévot taffit at moszumanska.debian.org
Fri Jul 4 03:13:03 UTC 2014


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

taffit pushed a commit to branch master
in repository owncloud.

commit 5b8c2ac750e79e574b49e0ba7ac866f0d5002003
Author: Robin Appelman <icewind at owncloud.com>
Date:   Fri Jun 27 17:10:46 2014 +0200

    Use the etag to check for updates in webdav storages where available
---
 lib/private/files/storage/dav.php | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php
index 8536c65..64c6187 100644
--- a/lib/private/files/storage/dav.php
+++ b/lib/private/files/storage/dav.php
@@ -449,5 +449,24 @@ class DAV extends \OC\Files\Storage\Common {
 			return 0;
 		}
 	}
+
+	/**
+	 * check if a file or folder has been updated since $time
+	 *
+	 * @param string $path
+	 * @param int $time
+	 * @return bool
+	 */
+	public function hasUpdated($path, $time) {
+		$this->init();
+		$response = $this->client->propfind($this->encodePath($path), array('{DAV:}getlastmodified', '{DAV:}getetag'));
+		if (isset($response['{DAV:}getetag'])) {
+			$cachedData = $this->getCache()->get($path);
+			return $cachedData['etag'] !== $response['{DAV:}getetag'];
+		} else {
+			$remoteMtime = strtotime($response['{DAV:}getlastmodified']);
+			return $remoteMtime > $time;
+		}
+	}
 }
 

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



More information about the Pkg-owncloud-commits mailing list