summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2016-02-26 12:48:56 +0100
committerRobin Appelman <icewind@owncloud.com>2016-02-26 13:55:12 +0100
commit1384bf5066c38f09e8c6995d26aa5c03dd63ec2c (patch)
tree48bd7d3ed3725efde8f1815c2fae1b2f515f9724 /lib
parente17bc565b7524adce7fbf6bf72d22d98d2fefcfc (diff)
downloadnextcloud-server-1384bf5066c38f09e8c6995d26aa5c03dd63ec2c.tar.gz
nextcloud-server-1384bf5066c38f09e8c6995d26aa5c03dd63ec2c.zip
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);
}