summaryrefslogtreecommitdiffstats
path: root/lib/private/files/cache/updater.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/files/cache/updater.php')
-rw-r--r--lib/private/files/cache/updater.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php
index 31a4a7c21e7..248748ea4a9 100644
--- a/lib/private/files/cache/updater.php
+++ b/lib/private/files/cache/updater.php
@@ -13,6 +13,11 @@ namespace OC\Files\Cache;
*/
class Updater {
/**
+ * @var bool
+ */
+ protected $enabled = true;
+
+ /**
* @var \OC\Files\View
*/
protected $view;
@@ -30,7 +35,18 @@ class Updater {
$this->propagator = new ChangePropagator($view);
}
+ public function disable() {
+ $this->enabled = false;
+ }
+
+ public function enable() {
+ $this->enabled = true;
+ }
+
public function propagate($path, $time = null) {
+ if (Scanner::isPartialFile($path)) {
+ return;
+ }
$this->propagator->addChange($path);
$this->propagator->propagateChanges($time);
}
@@ -42,6 +58,9 @@ class Updater {
* @param int $time
*/
public function update($path, $time = null) {
+ if (!$this->enabled or Scanner::isPartialFile($path)) {
+ return;
+ }
/**
* @var \OC\Files\Storage\Storage $storage
* @var string $internalPath
@@ -64,6 +83,9 @@ class Updater {
* @param string $path
*/
public function remove($path) {
+ if (!$this->enabled or Scanner::isPartialFile($path)) {
+ return;
+ }
/**
* @var \OC\Files\Storage\Storage $storage
* @var string $internalPath
@@ -88,6 +110,9 @@ class Updater {
* @param string $target
*/
public function rename($source, $target) {
+ if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) {
+ return;
+ }
/**
* @var \OC\Files\Storage\Storage $sourceStorage
* @var \OC\Files\Storage\Storage $targetStorage
@@ -104,6 +129,9 @@ class Updater {
if ($sourceStorage && $targetStorage) {
if ($sourceStorage === $targetStorage) {
$cache = $sourceStorage->getCache($sourceInternalPath);
+ if ($cache->inCache($targetInternalPath)) {
+ $cache->remove($targetInternalPath);
+ }
$cache->move($sourceInternalPath, $targetInternalPath);
if (pathinfo($sourceInternalPath, PATHINFO_EXTENSION) !== pathinfo($targetInternalPath, PATHINFO_EXTENSION)) {