summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-04-30 14:16:09 +0200
committerRobin Appelman <icewind@owncloud.com>2015-04-30 14:48:42 +0200
commitba7d221cffab4b42871e5926dd6c3e0a2d2b98dc (patch)
tree7036af4364af0e32f80774f6ad226d4762609c46 /lib
parent8119b8b0403b83970f329a8512de980580b013d6 (diff)
downloadnextcloud-server-ba7d221cffab4b42871e5926dd6c3e0a2d2b98dc.tar.gz
nextcloud-server-ba7d221cffab4b42871e5926dd6c3e0a2d2b98dc.zip
allow getting the path from the lockedexception
Diffstat (limited to 'lib')
-rw-r--r--lib/private/lock/memcachelockingprovider.php4
-rw-r--r--lib/public/lock/lockedexception.php21
2 files changed, 23 insertions, 2 deletions
diff --git a/lib/private/lock/memcachelockingprovider.php b/lib/private/lock/memcachelockingprovider.php
index 43fdf70bc8b..9c8c7235462 100644
--- a/lib/private/lock/memcachelockingprovider.php
+++ b/lib/private/lock/memcachelockingprovider.php
@@ -62,12 +62,12 @@ class MemcacheLockingProvider implements ILockingProvider {
public function acquireLock($path, $type) {
if ($type === self::LOCK_SHARED) {
if (!$this->memcache->inc($path)) {
- throw new LockedException($path . ' is locked');
+ throw new LockedException($path);
}
} else {
$this->memcache->add($path, 0);
if (!$this->memcache->cas($path, 0, 'exclusive')) {
- throw new LockedException($path . ' is locked');
+ throw new LockedException($path);
}
}
}
diff --git a/lib/public/lock/lockedexception.php b/lib/public/lock/lockedexception.php
index 4c0ca9b8c5b..87f7164b7e0 100644
--- a/lib/public/lock/lockedexception.php
+++ b/lib/public/lock/lockedexception.php
@@ -22,4 +22,25 @@
namespace OCP\Lock;
class LockedException extends \Exception {
+ /**
+ * @var string
+ */
+ private $path;
+
+ /**
+ * LockedException constructor.
+ *
+ * @param string $path
+ */
+ public function __construct($path) {
+ parent::__construct($path . ' is locked');
+ $this->path = $path;
+ }
+
+ /**
+ * @return string
+ */
+ public function getPath() {
+ return $this->path;
+ }
}