[Pkg-owncloud-commits] [owncloud] 229/457: Move locking exceptions

David Prévot taffit at moszumanska.debian.org
Sun Jun 28 20:06:13 UTC 2015


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

taffit pushed a commit to branch stable8
in repository owncloud.

commit 0451a6652d7dcac3887bdf760593482eaa19e681
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Fri May 29 10:55:25 2015 +0200

    Move locking exceptions
---
 lib/private/connector/sabre/directory.php  | 17 +++++++++++++----
 lib/private/connector/sabre/objecttree.php |  2 ++
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/lib/private/connector/sabre/directory.php b/lib/private/connector/sabre/directory.php
index ef35b30..82e1b55 100644
--- a/lib/private/connector/sabre/directory.php
+++ b/lib/private/connector/sabre/directory.php
@@ -28,6 +28,8 @@
 namespace OC\Connector\Sabre;
 
 use OC\Connector\Sabre\Exception\InvalidPath;
+use OC\Connector\Sabre\Exception\FileLocked;
+use OCP\Lock\LockedException;
 
 class Directory extends \OC\Connector\Sabre\Node
 	implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota {
@@ -102,6 +104,8 @@ class Directory extends \OC\Connector\Sabre\Node
 			return $node->put($data);
 		} catch (\OCP\Files\StorageNotAvailableException $e) {
 			throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
+		} catch (LockedException $e) {
+			throw new FileLocked($e->getMessage(), $e->getCode(), $e);
 		}
 	}
 
@@ -127,6 +131,8 @@ class Directory extends \OC\Connector\Sabre\Node
 			throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
 		} catch (\OCP\Files\InvalidPathException $ex) {
 			throw new InvalidPath($ex->getMessage());
+		} catch (LockedException $e) {
+			throw new FileLocked($e->getMessage(), $e->getCode(), $e);
 		}
 	}
 
@@ -211,11 +217,14 @@ class Directory extends \OC\Connector\Sabre\Node
 			throw new \Sabre\DAV\Exception\Forbidden();
 		}
 
-		if (!$this->fileView->rmdir($this->path)) {
-			// assume it wasn't possible to remove due to permission issue
-			throw new \Sabre\DAV\Exception\Forbidden();
+		try {
+			if (!$this->fileView->rmdir($this->path)) {
+				// assume it wasn't possible to remove due to permission issue
+				throw new \Sabre\DAV\Exception\Forbidden();
+			}
+		} catch (LockedException $e) {
+			throw new FileLocked($e->getMessage(), $e->getCode(), $e);
 		}
-
 	}
 
 	/**
diff --git a/lib/private/connector/sabre/objecttree.php b/lib/private/connector/sabre/objecttree.php
index ed42a31..c56fd7e 100644
--- a/lib/private/connector/sabre/objecttree.php
+++ b/lib/private/connector/sabre/objecttree.php
@@ -264,6 +264,8 @@ class ObjectTree extends \Sabre\DAV\Tree {
 			$this->fileView->copy($source, $destination);
 		} catch (StorageNotAvailableException $e) {
 			throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
+		} catch (LockedException $e) {
+			throw new FileLocked($e->getMessage(), $e->getCode(), $e);
 		}
 
 		list($destinationDir,) = \Sabre\HTTP\URLUtil::splitPath($destination);

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