Skip to content
Snippets Groups Projects
Commit f6182aa8 authored by Robin Appelman's avatar Robin Appelman Committed by Vincent Petry
Browse files

Allow disabling the cache updater

parent b4dfd043
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,11 @@ namespace OC\Files\Cache; ...@@ -12,6 +12,11 @@ namespace OC\Files\Cache;
* Update the cache and propagate changes * Update the cache and propagate changes
*/ */
class Updater { class Updater {
/**
* @var bool
*/
protected $enabled = true;
/** /**
* @var \OC\Files\View * @var \OC\Files\View
*/ */
...@@ -30,6 +35,14 @@ class Updater { ...@@ -30,6 +35,14 @@ class Updater {
$this->propagator = new ChangePropagator($view); $this->propagator = new ChangePropagator($view);
} }
public function disable() {
$this->enabled = false;
}
public function enable() {
$this->enabled = true;
}
public function propagate($path, $time = null) { public function propagate($path, $time = null) {
if (Scanner::isPartialFile($path)) { if (Scanner::isPartialFile($path)) {
return; return;
...@@ -45,7 +58,7 @@ class Updater { ...@@ -45,7 +58,7 @@ class Updater {
* @param int $time * @param int $time
*/ */
public function update($path, $time = null) { public function update($path, $time = null) {
if (Scanner::isPartialFile($path)) { if (!$this->enabled or Scanner::isPartialFile($path)) {
return; return;
} }
/** /**
...@@ -70,7 +83,7 @@ class Updater { ...@@ -70,7 +83,7 @@ class Updater {
* @param string $path * @param string $path
*/ */
public function remove($path) { public function remove($path) {
if (Scanner::isPartialFile($path)) { if (!$this->enabled or Scanner::isPartialFile($path)) {
return; return;
} }
/** /**
...@@ -97,7 +110,7 @@ class Updater { ...@@ -97,7 +110,7 @@ class Updater {
* @param string $target * @param string $target
*/ */
public function rename($source, $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; return;
} }
/** /**
......
...@@ -1528,4 +1528,11 @@ class View { ...@@ -1528,4 +1528,11 @@ class View {
$mount $mount
); );
} }
/**
* @return Updater
*/
public function getUpdater(){
return $this->updater;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment