diff options
author | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-04-20 20:37:27 +0200 |
---|---|---|
committer | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-04-20 20:37:27 +0200 |
commit | cd01c440a01744d666df275cb7941fa29d2283dd (patch) | |
tree | d09caccace60dcfcc42e9b00ae2d810ec29643cc /lib/private/files/storage | |
parent | cdcabbd0b3f6209b2a312b30a84c381f125bcf68 (diff) | |
parent | b53d6598f10c97318fbf065369f5b097eb134e28 (diff) | |
download | nextcloud-server-cd01c440a01744d666df275cb7941fa29d2283dd.tar.gz nextcloud-server-cd01c440a01744d666df275cb7941fa29d2283dd.zip |
Merge pull request #23919 from owncloud/cyclyc-share-dep-example
SharedStorage to new sharing code + cleanup
Diffstat (limited to 'lib/private/files/storage')
-rw-r--r-- | lib/private/files/storage/common.php | 24 | ||||
-rw-r--r-- | lib/private/files/storage/wrapper/jail.php | 46 | ||||
-rw-r--r-- | lib/private/files/storage/wrapper/wrapper.php | 6 |
3 files changed, 63 insertions, 13 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/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 */ |