diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php index eeb763921b..248748ea4a 100644 --- a/lib/private/files/cache/updater.php +++ b/lib/private/files/cache/updater.php @@ -12,6 +12,11 @@ namespace OC\Files\Cache; * Update the cache and propagate changes */ class Updater { + /** + * @var bool + */ + protected $enabled = true; + /** * @var \OC\Files\View */ @@ -30,6 +35,14 @@ 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; @@ -45,7 +58,7 @@ class Updater { * @param int $time */ public function update($path, $time = null) { - if (Scanner::isPartialFile($path)) { + if (!$this->enabled or Scanner::isPartialFile($path)) { return; } /** @@ -70,7 +83,7 @@ class Updater { * @param string $path */ public function remove($path) { - if (Scanner::isPartialFile($path)) { + if (!$this->enabled or Scanner::isPartialFile($path)) { return; } /** @@ -97,7 +110,7 @@ class Updater { * @param string $target */ public function rename($source, $target) { - if (Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) { + if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) { return; } /** diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 9cf7eaa2ec..4f9a4001d6 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -1528,4 +1528,11 @@ class View { $mount ); } + + /** + * @return Updater + */ + public function getUpdater(){ + return $this->updater; + } }