summaryrefslogtreecommitdiffstats
path: root/lib/private/files/storage/dav.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-06-30 15:46:37 +0200
committerRobin Appelman <icewind@owncloud.com>2014-06-30 15:46:37 +0200
commitd78a2a9f78dc2a65bffa8f3fc4299c4540c4d5be (patch)
tree3c5f84e6271daadf1a513b262d8d3ddba5385c4e /lib/private/files/storage/dav.php
parentd94d307f522ce724ac288f57f563338f7229db4c (diff)
downloadnextcloud-server-d78a2a9f78dc2a65bffa8f3fc4299c4540c4d5be.tar.gz
nextcloud-server-d78a2a9f78dc2a65bffa8f3fc4299c4540c4d5be.zip
Add StorageNotAvailableException
Diffstat (limited to 'lib/private/files/storage/dav.php')
-rw-r--r--lib/private/files/storage/dav.php44
1 files changed, 27 insertions, 17 deletions
diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php
index 8b97f750204..726688fe444 100644
--- a/lib/private/files/storage/dav.php
+++ b/lib/private/files/storage/dav.php
@@ -8,6 +8,9 @@
namespace OC\Files\Storage;
+use OCP\Files\StorageNotAvailableException;
+use Sabre\DAV\Exception;
+
class DAV extends \OC\Files\Storage\Common {
protected $password;
protected $user;
@@ -463,29 +466,36 @@ class DAV extends \OC\Files\Storage\Common {
*
* @param string $path
* @param int $time
+ * @throws \OCP\Files\StorageNotAvailableException
* @return bool
*/
public function hasUpdated($path, $time) {
$this->init();
- $response = $this->client->propfind($this->encodePath($path), array(
- '{DAV:}getlastmodified',
- '{DAV:}getetag',
- '{http://owncloud.org/ns}permissions'
- ));
- if (isset($response['{DAV:}getetag'])) {
- $cachedData = $this->getCache()->get($path);
- $etag = trim($response['{DAV:}getetag'], '"');
- if ($cachedData['etag'] !== $etag) {
- return true;
- } else if (isset($response['{http://owncloud.org/ns}permissions'])) {
- $permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']);
- return $permissions !== $cachedData['permissions'];
+ try {
+ $response = $this->client->propfind($this->encodePath($path), array(
+ '{DAV:}getlastmodified',
+ '{DAV:}getetag',
+ '{http://owncloud.org/ns}permissions'
+ ));
+ if (isset($response['{DAV:}getetag'])) {
+ $cachedData = $this->getCache()->get($path);
+ $etag = trim($response['{DAV:}getetag'], '"');
+ if ($cachedData['etag'] !== $etag) {
+ return true;
+ } else if (isset($response['{http://owncloud.org/ns}permissions'])) {
+ $permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']);
+ return $permissions !== $cachedData['permissions'];
+ } else {
+ return false;
+ }
} else {
- return false;
+ $remoteMtime = strtotime($response['{DAV:}getlastmodified']);
+ return $remoteMtime > $time;
}
- } else {
- $remoteMtime = strtotime($response['{DAV:}getlastmodified']);
- return $remoteMtime > $time;
+ } catch (Exception\NotFound $e) {
+ return false;
+ } catch (Exception $e) {
+ throw new StorageNotAvailableException();
}
}
}