summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php34
1 files changed, 8 insertions, 26 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php
index 8f595f05bc1..7afdb746a98 100644
--- a/apps/files_external/lib/Lib/Storage/SMB.php
+++ b/apps/files_external/lib/Lib/Storage/SMB.php
@@ -91,6 +91,7 @@ class SMB extends Common implements INotifyStorage {
throw new \Exception('Invalid configuration');
}
$this->statCache = new CappedMemoryCache();
+ parent::__construct($params);
}
/**
@@ -187,16 +188,17 @@ class SMB extends Common implements INotifyStorage {
return false;
}
+ $absoluteSource = $this->buildPath($source);
+ $absoluteTarget = $this->buildPath($target);
try {
- $result = $this->share->rename($this->root . $source, $this->root . $target);
- unset($this->statCache[$this->root . $source], $this->statCache[$this->root . $target]);
+ $result = $this->share->rename($absoluteSource, $absoluteTarget);
} catch (AlreadyExistsException $e) {
- $this->unlink($target);
- $result = $this->share->rename($this->root . $source, $this->root . $target);
- unset($this->statCache[$this->root . $source], $this->statCache[$this->root . $target]);
+ $this->remove($target);
+ $result = $this->share->rename($absoluteSource, $absoluteTarget);
} catch (\Exception $e) {
- $result = false;
+ return false;
}
+ unset($this->statCache[$absoluteSource], $this->statCache[$absoluteTarget]);
return $result;
}
@@ -275,26 +277,6 @@ class SMB extends Common implements INotifyStorage {
}
/**
- * @param string $path1 the old name
- * @param string $path2 the new name
- * @return bool
- */
- public function rename($path1, $path2) {
- try {
- $this->remove($path2);
- $path1 = $this->buildPath($path1);
- $path2 = $this->buildPath($path2);
- return $this->share->rename($path1, $path2);
- } catch (NotFoundException $e) {
- return false;
- } catch (ForbiddenException $e) {
- return false;
- } catch (ConnectException $e) {
- throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
* check if a file or folder has been updated since $time
*
* @param string $path