aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/files/storage
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/files/storage')
-rw-r--r--lib/private/files/storage/common.php24
-rw-r--r--lib/private/files/storage/wrapper/encryption.php7
-rw-r--r--lib/private/files/storage/wrapper/jail.php46
-rw-r--r--lib/private/files/storage/wrapper/wrapper.php6
4 files changed, 67 insertions, 16 deletions
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 85c2e1c6700..3a811b312c6 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -313,20 +313,20 @@ abstract class Common implements Storage, ILockingStorage {
if (!$storage) {
$storage = $this;
}
- if (!isset($this->cache)) {
- $this->cache = new Cache($storage);
+ if (!isset($storage->cache)) {
+ $storage->cache = new Cache($storage);
}
- return $this->cache;
+ return $storage->cache;
}
public function getScanner($path = '', $storage = null) {
if (!$storage) {
$storage = $this;
}
- if (!isset($this->scanner)) {
- $this->scanner = new Scanner($storage);
+ if (!isset($storage->scanner)) {
+ $storage->scanner = new Scanner($storage);
}
- return $this->scanner;
+ return $storage->scanner;
}
public function getWatcher($path = '', $storage = null) {
@@ -351,20 +351,20 @@ abstract class Common implements Storage, ILockingStorage {
if (!$storage) {
$storage = $this;
}
- if (!isset($this->propagator)) {
- $this->propagator = new Propagator($storage);
+ if (!isset($storage->propagator)) {
+ $storage->propagator = new Propagator($storage);
}
- return $this->propagator;
+ return $storage->propagator;
}
public function getUpdater($storage = null) {
if (!$storage) {
$storage = $this;
}
- if (!isset($this->updater)) {
- $this->updater = new Updater($storage);
+ if (!isset($storage->updater)) {
+ $storage->updater = new Updater($storage);
}
- return $this->updater;
+ return $storage->updater;
}
public function getStorageCache($storage = null) {
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php
index 1add4d7fd0a..02da978a700 100644
--- a/lib/private/files/storage/wrapper/encryption.php
+++ b/lib/private/files/storage/wrapper/encryption.php
@@ -627,9 +627,10 @@ class Encryption extends Wrapper {
* @param string $sourceInternalPath
* @param string $targetInternalPath
* @param bool $preserveMtime
+ * @param bool $isRename
* @return bool
*/
- public function copyFromStorage(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) {
+ public function copyFromStorage(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false, $isRename = false) {
// TODO clean this up once the underlying moveFromStorage in OC\Files\Storage\Wrapper\Common is fixed:
// - call $this->storage->copyFromStorage() instead of $this->copyBetweenStorage
@@ -637,7 +638,7 @@ class Encryption extends Wrapper {
// - copy the copyKeys() call from $this->copyBetweenStorage to this method
// - remove $this->copyBetweenStorage
- return $this->copyBetweenStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime, false);
+ return $this->copyBetweenStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime, $isRename);
}
/**
@@ -732,7 +733,7 @@ class Encryption extends Wrapper {
if (is_resource($dh)) {
while ($result and ($file = readdir($dh)) !== false) {
if (!Filesystem::isIgnoredDir($file)) {
- $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file);
+ $result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file, false, $isRename);
}
}
}
diff --git a/lib/private/files/storage/wrapper/jail.php b/lib/private/files/storage/wrapper/jail.php
index e5f5ab90359..e8063f670c5 100644
--- a/lib/private/files/storage/wrapper/jail.php
+++ b/lib/private/files/storage/wrapper/jail.php
@@ -47,7 +47,7 @@ class Jail extends Wrapper {
$this->rootPath = $arguments['root'];
}
- protected function getSourcePath($path) {
+ public function getSourcePath($path) {
if ($path === '') {
return $this->rootPath;
} else {
@@ -417,6 +417,14 @@ class Jail extends Wrapper {
/**
* @param string $path
+ * @return array
+ */
+ public function getMetaData($path) {
+ return $this->storage->getMetaData($this->getSourcePath($path));
+ }
+
+ /**
+ * @param string $path
* @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
* @param \OCP\Lock\ILockingProvider $provider
* @throws \OCP\Lock\LockedException
@@ -442,4 +450,40 @@ class Jail extends Wrapper {
public function changeLock($path, $type, ILockingProvider $provider) {
$this->storage->changeLock($this->getSourcePath($path), $type, $provider);
}
+
+ /**
+ * Resolve the path for the source of the share
+ *
+ * @param string $path
+ * @return array
+ */
+ public function resolvePath($path) {
+ return [$this->storage, $this->getSourcePath($path)];
+ }
+
+ /**
+ * @param \OCP\Files\Storage $sourceStorage
+ * @param string $sourceInternalPath
+ * @param string $targetInternalPath
+ * @return bool
+ */
+ public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
+ if ($sourceStorage === $this) {
+ return $this->copy($sourceInternalPath, $targetInternalPath);
+ }
+ return $this->storage->copyFromStorage($sourceStorage, $sourceInternalPath, $this->getSourcePath($targetInternalPath));
+ }
+
+ /**
+ * @param \OCP\Files\Storage $sourceStorage
+ * @param string $sourceInternalPath
+ * @param string $targetInternalPath
+ * @return bool
+ */
+ public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
+ if ($sourceStorage === $this) {
+ return $this->rename($sourceInternalPath, $targetInternalPath);
+ }
+ return $this->storage->moveFromStorage($sourceStorage, $sourceInternalPath, $this->getSourcePath($targetInternalPath));
+ }
}
diff --git a/lib/private/files/storage/wrapper/wrapper.php b/lib/private/files/storage/wrapper/wrapper.php
index 12914e7a1b8..21d7db1099b 100644
--- a/lib/private/files/storage/wrapper/wrapper.php
+++ b/lib/private/files/storage/wrapper/wrapper.php
@@ -35,6 +35,12 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage {
*/
protected $storage;
+ public $cache;
+ public $scanner;
+ public $watcher;
+ public $propagator;
+ public $updater;
+
/**
* @param array $parameters
*/