summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-05-13 13:37:18 +0200
committerRobin Appelman <icewind@owncloud.com>2015-06-01 13:22:56 +0200
commit35c377f7a9a0413bea5fa6768467c6e5f7c2d83e (patch)
tree90d02e117cbe715141b1053280c51da998ce1c4c /lib
parent8d53dc803f978f0b2e5db1c3503dc5fb0d55b0c5 (diff)
downloadnextcloud-server-35c377f7a9a0413bea5fa6768467c6e5f7c2d83e.tar.gz
nextcloud-server-35c377f7a9a0413bea5fa6768467c6e5f7c2d83e.zip
phpdoc and minor issues
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/storage/storage.php4
-rw-r--r--lib/private/files/view.php26
-rw-r--r--lib/public/files/storage.php4
3 files changed, 21 insertions, 13 deletions
diff --git a/lib/private/files/storage/storage.php b/lib/private/files/storage/storage.php
index 8b34908e610..642544bad37 100644
--- a/lib/private/files/storage/storage.php
+++ b/lib/private/files/storage/storage.php
@@ -78,7 +78,7 @@ interface Storage extends \OCP\Files\Storage {
public function getMetaData($path);
/**
- * @param string $path
+ * @param string $path The path of the file to acquire the lock for
* @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
* @param \OCP\Lock\ILockingProvider $provider
* @throws \OCP\Lock\LockedException
@@ -86,7 +86,7 @@ interface Storage extends \OCP\Files\Storage {
public function acquireLock($path, $type, ILockingProvider $provider);
/**
- * @param string $path
+ * @param string $path The path of the file to release the lock for
* @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
* @param \OCP\Lock\ILockingProvider $provider
*/
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index b499bbb3641..b8bbd60f028 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -971,9 +971,9 @@ class View {
}
} catch (\Exception $e) {
if (in_array('write', $hooks) || in_array('delete', $hooks)) {
- $this->lockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
+ $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
} else {
- $this->lockFile($path, ILockingProvider::LOCK_SHARED);
+ $this->unlockFile($path, ILockingProvider::LOCK_SHARED);
}
throw $e;
}
@@ -1638,6 +1638,10 @@ class View {
return $result;
}
+ /**
+ * @param string $path the path of the file to lock, relative to the view
+ * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
+ */
private function lockPath($path, $type) {
$mount = $this->getMount($path);
if ($mount) {
@@ -1651,6 +1655,10 @@ class View {
}
}
+ /**
+ * @param string $path the path of the file to unlock, relative to the view
+ * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
+ */
private function unlockPath($path, $type) {
$mount = $this->getMount($path);
if ($mount) {
@@ -1665,13 +1673,13 @@ class View {
}
/**
- * Lock a path and all it's parents
+ * Lock a path and all its parents up to the root of the view
*
- * @param string $path
- * @param int $type
+ * @param string $path the path of the file to lock relative to the view
+ * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
*/
public function lockFile($path, $type) {
- $path = rtrim($path, '/');
+ $path = '/' . trim($path, '/');
$this->lockPath($path, $type);
$parents = $this->getParents($path);
@@ -1681,10 +1689,10 @@ class View {
}
/**
- * Unlock a path and all it's parents
+ * Unlock a path and all its parents up to the root of the view
*
- * @param string $path
- * @param int $type
+ * @param string $path the path of the file to lock relative to the view
+ * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
*/
public function unlockFile($path, $type) {
$path = rtrim($path, '/');
diff --git a/lib/public/files/storage.php b/lib/public/files/storage.php
index ea1da575959..68d00fab34c 100644
--- a/lib/public/files/storage.php
+++ b/lib/public/files/storage.php
@@ -416,7 +416,7 @@ interface Storage {
public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath);
/**
- * @param string $path
+ * @param string $path The path of the file to acquire the lock for
* @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
* @param \OCP\Lock\ILockingProvider $provider
* @throws \OCP\Lock\LockedException
@@ -424,7 +424,7 @@ interface Storage {
public function acquireLock($path, $type, ILockingProvider $provider);
/**
- * @param string $path
+ * @param string $path The path of the file to acquire the lock for
* @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
* @param \OCP\Lock\ILockingProvider $provider
*/