summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-02-26 14:56:31 +0100
committerMorris Jobke <hey@morrisjobke.de>2016-02-26 14:56:31 +0100
commitbbfc5bbf30a22c268ede1223707e5d50ae9cc4f1 (patch)
tree48fd2e42be895df4a8290e30dcd559ec3e925891 /lib
parent54f8ec8be0bf6fcd908018681542fd9689abe617 (diff)
parent1384bf5066c38f09e8c6995d26aa5c03dd63ec2c (diff)
downloadnextcloud-server-bbfc5bbf30a22c268ede1223707e5d50ae9cc4f1.tar.gz
nextcloud-server-bbfc5bbf30a22c268ede1223707e5d50ae9cc4f1.zip
Merge pull request #22676 from owncloud/fed-share-etag-82
[8.2] use the default view for propagation if possible
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/cache/updater.php33
-rw-r--r--lib/private/files/view.php3
2 files changed, 28 insertions, 8 deletions
diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php
index 2de0c8fe067..c687d190873 100644
--- a/lib/private/files/cache/updater.php
+++ b/lib/private/files/cache/updater.php
@@ -24,6 +24,7 @@
*/
namespace OC\Files\Cache;
+use OC\Files\View;
/**
* Update the cache and propagate changes
@@ -48,11 +49,29 @@ class Updater {
protected $propagator;
/**
+ * @var null|View
+ */
+ protected $propagatorView;
+
+ /**
* @param \OC\Files\View $view the view the updater works on, usually the view of the logged in user
+ * @param View | null $userView
*/
- public function __construct($view) {
+ public function __construct(View $view, $userView = null) {
$this->view = $view;
- $this->propagator = new ChangePropagator($view);
+
+ // use the userview if the view is a subfolder
+ if ($userView && $userView->getRelativePath($view->getRoot())) {
+ $this->propagatorView = $userView;
+ $this->propagator = new ChangePropagator($userView);
+ } else {
+ $this->propagatorView = $view;
+ $this->propagator = new ChangePropagator($view);
+ }
+ }
+
+ protected function getPropagatorPath($path) {
+ return $this->propagatorView->getRelativePath($this->view->getAbsolutePath($path));
}
/**
@@ -88,7 +107,7 @@ class Updater {
if (Scanner::isPartialFile($path)) {
return;
}
- $this->propagator->addChange($path);
+ $this->propagator->addChange($this->getPropagatorPath($path));
$this->propagator->propagateChanges($time);
}
@@ -108,7 +127,7 @@ class Updater {
*/
list($storage, $internalPath) = $this->view->resolvePath($path);
if ($storage) {
- $this->propagator->addChange($path);
+ $this->propagator->addChange($this->getPropagatorPath($path));
$cache = $storage->getCache($internalPath);
$scanner = $storage->getScanner($internalPath);
$data = $scanner->scan($internalPath, Scanner::SCAN_SHALLOW, -1, false);
@@ -137,7 +156,7 @@ class Updater {
if ($parent === '.') {
$parent = '';
}
- $this->propagator->addChange($path);
+ $this->propagator->addChange($this->getPropagatorPath($path));
$cache = $storage->getCache($internalPath);
$cache->remove($internalPath);
$cache->correctFolderSize($parent);
@@ -193,8 +212,8 @@ class Updater {
$targetCache->correctFolderSize($targetInternalPath);
$this->correctParentStorageMtime($sourceStorage, $sourceInternalPath);
$this->correctParentStorageMtime($targetStorage, $targetInternalPath);
- $this->propagator->addChange($source);
- $this->propagator->addChange($target);
+ $this->propagator->addChange($this->getPropagatorPath($source));
+ $this->propagator->addChange($this->getPropagatorPath($target));
$this->propagator->propagateChanges();
}
}
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index a89f802e3d1..4f3fb5be582 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -95,7 +95,8 @@ class View {
}
$this->fakeRoot = $root;
- $this->updater = new Updater($this);
+
+ $this->updater = new Updater($this, Filesystem::getView());
$this->lockingProvider = \OC::$server->getLockingProvider();
$this->lockingEnabled = !($this->lockingProvider instanceof \OC\Lock\NoopLockingProvider);
}