phpdoc and minor issues

This commit is contained in:
Robin Appelman 2015-05-13 13:37:18 +02:00
parent 8d53dc803f
commit 35c377f7a9
3 changed files with 21 additions and 13 deletions

View File

@ -78,7 +78,7 @@ interface Storage extends \OCP\Files\Storage {
public function getMetaData($path); 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 int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
* @param \OCP\Lock\ILockingProvider $provider * @param \OCP\Lock\ILockingProvider $provider
* @throws \OCP\Lock\LockedException * @throws \OCP\Lock\LockedException
@ -86,7 +86,7 @@ interface Storage extends \OCP\Files\Storage {
public function acquireLock($path, $type, ILockingProvider $provider); 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 int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
* @param \OCP\Lock\ILockingProvider $provider * @param \OCP\Lock\ILockingProvider $provider
*/ */

View File

@ -971,9 +971,9 @@ class View {
} }
} catch (\Exception $e) { } catch (\Exception $e) {
if (in_array('write', $hooks) || in_array('delete', $hooks)) { if (in_array('write', $hooks) || in_array('delete', $hooks)) {
$this->lockFile($path, ILockingProvider::LOCK_EXCLUSIVE); $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE);
} else { } else {
$this->lockFile($path, ILockingProvider::LOCK_SHARED); $this->unlockFile($path, ILockingProvider::LOCK_SHARED);
} }
throw $e; throw $e;
} }
@ -1638,6 +1638,10 @@ class View {
return $result; 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) { private function lockPath($path, $type) {
$mount = $this->getMount($path); $mount = $this->getMount($path);
if ($mount) { 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) { private function unlockPath($path, $type) {
$mount = $this->getMount($path); $mount = $this->getMount($path);
if ($mount) { 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 string $path the path of the file to lock relative to the view
* @param int $type * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
*/ */
public function lockFile($path, $type) { public function lockFile($path, $type) {
$path = rtrim($path, '/'); $path = '/' . trim($path, '/');
$this->lockPath($path, $type); $this->lockPath($path, $type);
$parents = $this->getParents($path); $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 string $path the path of the file to lock relative to the view
* @param int $type * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
*/ */
public function unlockFile($path, $type) { public function unlockFile($path, $type) {
$path = rtrim($path, '/'); $path = rtrim($path, '/');

View File

@ -416,7 +416,7 @@ interface Storage {
public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath); 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 int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
* @param \OCP\Lock\ILockingProvider $provider * @param \OCP\Lock\ILockingProvider $provider
* @throws \OCP\Lock\LockedException * @throws \OCP\Lock\LockedException
@ -424,7 +424,7 @@ interface Storage {
public function acquireLock($path, $type, ILockingProvider $provider); 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 int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
* @param \OCP\Lock\ILockingProvider $provider * @param \OCP\Lock\ILockingProvider $provider
*/ */