diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-06-12 17:23:34 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-06-14 10:14:08 +0200 |
commit | 87e311b99628858ddb974cd35ae381a26b4bcdb5 (patch) | |
tree | 35b26ad637c6dbff04f35c188ccfd4cf0b5e7711 /lib/private | |
parent | decb51aee64d024059cf9f66b88e802270f8da09 (diff) | |
download | nextcloud-server-87e311b99628858ddb974cd35ae381a26b4bcdb5.tar.gz nextcloud-server-87e311b99628858ddb974cd35ae381a26b4bcdb5.zip |
Fix storage being passed to cache/watcher and scanner when using storage wrappers
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/files/storage/common.php | 28 | ||||
-rw-r--r-- | lib/private/files/storage/home.php | 7 | ||||
-rw-r--r-- | lib/private/files/storage/storage.php | 9 | ||||
-rw-r--r-- | lib/private/files/storage/wrapper/wrapper.php | 26 |
4 files changed, 51 insertions, 19 deletions
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 4d5a2078ef7..ecc75298b66 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -287,31 +287,43 @@ abstract class Common implements \OC\Files\Storage\Storage { return $this->filemtime($path) > $time; } - public function getCache($path = '') { + public function getCache($path = '', $storage = null) { + if (!$storage) { + $storage = $this; + } if (!isset($this->cache)) { - $this->cache = new \OC\Files\Cache\Cache($this); + $this->cache = new \OC\Files\Cache\Cache($storage); } return $this->cache; } - public function getScanner($path = '') { + public function getScanner($path = '', $storage = null) { + if (!$storage) { + $storage = $this; + } if (!isset($this->scanner)) { - $this->scanner = new \OC\Files\Cache\Scanner($this); + $this->scanner = new \OC\Files\Cache\Scanner($storage); } return $this->scanner; } - public function getWatcher($path = '') { + public function getWatcher($path = '', $storage = null) { + if (!$storage) { + $storage = $this; + } if (!isset($this->watcher)) { - $this->watcher = new \OC\Files\Cache\Watcher($this); + $this->watcher = new \OC\Files\Cache\Watcher($storage); $this->watcher->setPolicy(\OC::$server->getConfig()->getSystemValue('filesystem_check_changes', Watcher::CHECK_ONCE)); } return $this->watcher; } - public function getStorageCache() { + public function getStorageCache($storage = null) { + if (!$storage) { + $storage = $this; + } if (!isset($this->storageCache)) { - $this->storageCache = new \OC\Files\Cache\Storage($this); + $this->storageCache = new \OC\Files\Cache\Storage($storage); } return $this->storageCache; } diff --git a/lib/private/files/storage/home.php b/lib/private/files/storage/home.php index f66096f6d9c..214deede620 100644 --- a/lib/private/files/storage/home.php +++ b/lib/private/files/storage/home.php @@ -49,9 +49,12 @@ class Home extends Local { /** * @return \OC\Files\Cache\HomeCache */ - public function getCache($path = '') { + public function getCache($path = '', $storage = null) { + if (!$storage) { + $storage = $this; + } if (!isset($this->cache)) { - $this->cache = new \OC\Files\Cache\HomeCache($this); + $this->cache = new \OC\Files\Cache\HomeCache($storage); } return $this->cache; } diff --git a/lib/private/files/storage/storage.php b/lib/private/files/storage/storage.php index f085a0590b4..2139f464821 100644 --- a/lib/private/files/storage/storage.php +++ b/lib/private/files/storage/storage.php @@ -19,17 +19,19 @@ interface Storage extends \OCP\Files\Storage { * get a cache instance for the storage * * @param string $path + * @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache * @return \OC\Files\Cache\Cache */ - public function getCache($path = ''); + public function getCache($path = '', $storage = null); /** * get a scanner instance for the storage * * @param string $path + * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner * @return \OC\Files\Cache\Scanner */ - public function getScanner($path = ''); + public function getScanner($path = '', $storage = null); /** @@ -44,9 +46,10 @@ interface Storage extends \OCP\Files\Storage { * get a watcher instance for the cache * * @param string $path + * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher * @return \OC\Files\Cache\Watcher */ - public function getWatcher($path = ''); + public function getWatcher($path = '', $storage = null); /** * @return \OC\Files\Cache\Storage diff --git a/lib/private/files/storage/wrapper/wrapper.php b/lib/private/files/storage/wrapper/wrapper.php index 057c31c3cd8..d899c88363f 100644 --- a/lib/private/files/storage/wrapper/wrapper.php +++ b/lib/private/files/storage/wrapper/wrapper.php @@ -361,20 +361,28 @@ class Wrapper implements \OC\Files\Storage\Storage { * get a cache instance for the storage * * @param string $path + * @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache * @return \OC\Files\Cache\Cache */ - public function getCache($path = '') { - return $this->storage->getCache($path); + public function getCache($path = '', $storage = null) { + if (!$storage) { + $storage = $this; + } + return $this->storage->getCache($path, $storage); } /** * get a scanner instance for the storage * * @param string $path + * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner * @return \OC\Files\Cache\Scanner */ - public function getScanner($path = '') { - return $this->storage->getScanner($path); + public function getScanner($path = '', $storage = null) { + if (!$storage) { + $storage = $this; + } + return $this->storage->getScanner($path, $storage); } @@ -392,10 +400,14 @@ class Wrapper implements \OC\Files\Storage\Storage { * get a watcher instance for the cache * * @param string $path + * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher * @return \OC\Files\Cache\Watcher */ - public function getWatcher($path = '') { - return $this->storage->getWatcher($path); + public function getWatcher($path = '', $storage = null) { + if (!$storage) { + $storage = $this; + } + return $this->storage->getWatcher($path, $storage); } /** @@ -417,6 +429,7 @@ class Wrapper implements \OC\Files\Storage\Storage { /** * Returns true + * * @return true */ public function test() { @@ -425,6 +438,7 @@ class Wrapper implements \OC\Files\Storage\Storage { /** * Returns the wrapped storage's value for isLocal() + * * @return bool wrapped storage's isLocal() value */ public function isLocal() { |