From ddbbe1742fda9b508da5c6369dc2a2d5e19cec95 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 7 Jan 2016 18:13:35 +0100 Subject: propagate folder size in the same query for write updates --- apps/files_sharing/lib/sharedpropagator.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'apps/files_sharing') diff --git a/apps/files_sharing/lib/sharedpropagator.php b/apps/files_sharing/lib/sharedpropagator.php index fd3e14b28f8..29735934499 100644 --- a/apps/files_sharing/lib/sharedpropagator.php +++ b/apps/files_sharing/lib/sharedpropagator.php @@ -32,12 +32,13 @@ class SharedPropagator extends Propagator { /** * @param string $internalPath * @param int $time - * @return array[] all propagated entries + * @param int $sizeDifference + * @return \array[] all propagated entries */ - public function propagateChange($internalPath, $time) { + public function propagateChange($internalPath, $time, $sizeDifference = 0) { $source = $this->storage->getSourcePath($internalPath); /** @var \OC\Files\Storage\Storage $storage */ list($storage, $sourceInternalPath) = \OC\Files\Filesystem::resolvePath($source); - return $storage->getPropagator()->propagateChange($sourceInternalPath, $time); + return $storage->getPropagator()->propagateChange($sourceInternalPath, $time, $sizeDifference); } } -- cgit v1.2.3 From 30d6222e64e14d589f2ab8b8ef2ec015fc7e1bd5 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 11 Jan 2016 16:09:30 +0100 Subject: handle noopscanner in shared scanner --- apps/files_sharing/lib/scanner.php | 29 ++++++++++++++++++++++++++++- apps/files_sharing/lib/sharedstorage.php | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'apps/files_sharing') diff --git a/apps/files_sharing/lib/scanner.php b/apps/files_sharing/lib/scanner.php index bd6a28a4934..e9cc40ae42c 100644 --- a/apps/files_sharing/lib/scanner.php +++ b/apps/files_sharing/lib/scanner.php @@ -22,10 +22,14 @@ namespace OC\Files\Cache; +use OC\Files\ObjectStore\NoopScanner; +use OC\Files\Storage\Shared; + /** * Scanner for SharedStorage */ class SharedScanner extends Scanner { + private $sourceScanner; /** * Returns metadata from the shared storage, but @@ -35,12 +39,35 @@ class SharedScanner extends Scanner { * * @return array an array of metadata of the file */ - protected function getData($path){ + public function getData($path) { $data = parent::getData($path); $sourcePath = $this->storage->getSourcePath($path); list($sourceStorage, $internalPath) = \OC\Files\Filesystem::resolvePath($sourcePath); $data['permissions'] = $sourceStorage->getPermissions($internalPath); return $data; } + + private function getSourceScanner() { + if ($this->sourceScanner) { + return $this->sourceScanner; + } + if ($this->storage->instanceOfStorage('\OC\Files\Storage\Shared')) { + /** @var \OC\Files\Storage\Storage $storage */ + list($storage) = $this->storage->resolvePath(''); + $this->sourceScanner = $storage->getScanner(); + return $this->sourceScanner; + } else { + return null; + } + } + + public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true) { + $sourceScanner = $this->getSourceScanner(); + if ($sourceScanner instanceof NoopScanner) { + return []; + } else { + return parent::scanFile($file, $reuseExisting, $parentId, $cacheData, $lock); + } + } } diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 697856e1de5..542d0e9e48c 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -609,7 +609,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { * @param string $path * @return array */ - private function resolvePath($path) { + public function resolvePath($path) { $source = $this->getSourcePath($path); return \OC\Files\Filesystem::resolvePath($source); } -- cgit v1.2.3