From 209abaadbb6bf6c5b375a11f61e61fe47fb9b917 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 22 Jul 2015 15:12:36 +0200 Subject: expose locking api in sabre connector --- lib/private/connector/sabre/node.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/private/connector/sabre/node.php b/lib/private/connector/sabre/node.php index 7f4bf8ffed1..30faf9941bd 100644 --- a/lib/private/connector/sabre/node.php +++ b/lib/private/connector/sabre/node.php @@ -67,6 +67,7 @@ abstract class Node implements \Sabre\DAV\INode { /** * Sets up the node, expects a full path name + * * @param \OC\Files\View $view * @param \OCP\Files\FileInfo $info */ @@ -82,6 +83,7 @@ abstract class Node implements \Sabre\DAV\INode { /** * Returns the name of the node + * * @return string */ public function getName() { @@ -99,6 +101,7 @@ abstract class Node implements \Sabre\DAV\INode { /** * Renames the node + * * @param string $name The new name * @throws \Sabre\DAV\Exception\BadRequest * @throws \Sabre\DAV\Exception\Forbidden @@ -131,6 +134,7 @@ abstract class Node implements \Sabre\DAV\INode { /** * Returns the last modification time, as a unix timestamp + * * @return int timestamp as integer */ public function getLastModified() { @@ -212,7 +216,7 @@ abstract class Node implements \Sabre\DAV\INode { * @return string|null */ public function getDavPermissions() { - $p =''; + $p = ''; if ($this->info->isShared()) { $p .= 'S'; } @@ -248,4 +252,25 @@ abstract class Node implements \Sabre\DAV\INode { throw new InvalidPath($ex->getMessage()); } } + + /** + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + */ + public function acquireLock($type) { + $this->fileView->lockFile($this->path, $type); + } + + /** + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + */ + public function releaseLock($type) { + $this->fileView->unlockFile($this->path, $type); + } + + /** + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + */ + public function changeLock($type) { + $this->fileView->changeLock($this->path, $type); + } } -- cgit v1.2.3