[Pkg-owncloud-commits] [owncloud] 10/62: Get etag from remote OC server

David Prévot taffit at moszumanska.debian.org
Tue Jun 23 23:39:33 UTC 2015


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

taffit pushed a commit to annotated tag v8.0.5beta
in repository owncloud.

commit 533bb85a858904b433403ecfd2396b13403274c0
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Mon Apr 27 17:41:02 2015 +0200

    Get etag from remote OC server
---
 lib/private/files/storage/dav.php | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php
index 9734d36..1385c08 100644
--- a/lib/private/files/storage/dav.php
+++ b/lib/private/files/storage/dav.php
@@ -468,7 +468,7 @@ class DAV extends \OC\Files\Storage\Common {
 	public function getPermissions($path) {
 		$this->init();
 		$path = $this->cleanPath($path);
-		$response = $this->client->propfind($this->encodePath($path), array('{http://owncloud.org/ns}permissions'));
+		$response = $this->propfind($path);
 		if (isset($response['{http://owncloud.org/ns}permissions'])) {
 			return $this->parsePermissions($response['{http://owncloud.org/ns}permissions']);
 		} else if ($this->is_dir($path)) {
@@ -480,6 +480,17 @@ class DAV extends \OC\Files\Storage\Common {
 		}
 	}
 
+	/** {@inheritdoc} */
+	public function getETag($path) {
+		$this->init();
+		$path = $this->cleanPath($path);
+		$response = $this->propfind($path);
+		if (isset($response['{DAV:}getetag'])) {
+			return trim($response['{DAV:}getetag'], '"');
+		}
+		return parent::getEtag($path);
+	}
+
 	/**
 	 * @param string $permissionsString
 	 * @return int
@@ -521,8 +532,11 @@ class DAV extends \OC\Files\Storage\Common {
 			));
 			if (isset($response['{DAV:}getetag'])) {
 				$cachedData = $this->getCache()->get($path);
-				$etag = trim($response['{DAV:}getetag'], '"');
-				if ($cachedData['etag'] !== $etag) {
+				$etag = null;
+				if (isset($response['{DAV:}getetag'])) {
+					$etag = trim($response['{DAV:}getetag'], '"');
+				}
+				if (!empty($etag) && $cachedData['etag'] !== $etag) {
 					return true;
 				} else if (isset($response['{http://owncloud.org/ns}permissions'])) {
 					$permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']);

-- 
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