]> source.dussan.org Git - nextcloud-server.git/commitdiff
Allow disabling the cache updater
authorRobin Appelman <icewind@owncloud.com>
Fri, 27 Feb 2015 13:14:42 +0000 (14:14 +0100)
committerVincent Petry <pvince81@owncloud.com>
Fri, 27 Feb 2015 16:14:16 +0000 (17:14 +0100)
lib/private/files/cache/updater.php
lib/private/files/view.php

index eeb763921bb13a4ae9bc416bbd4319ee42986b2a..248748ea4a9db1b5b7a32b68b9eee6bee66546b9 100644 (file)
@@ -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;
                }
                /**
index 9cf7eaa2ec12a3b170335abaae009120100b5955..4f9a4001d697809d0ba5987d847ae24ff06d13a0 100644 (file)
@@ -1528,4 +1528,11 @@ class View {
                        $mount
                );
        }
+
+       /**
+        * @return Updater
+        */
+       public function getUpdater(){
+               return $this->updater;
+       }
 }