[Pkg-owncloud-commits] [owncloud] 06/118: Allow disabling the cache updater

David Prévot taffit at moszumanska.debian.org
Fri Mar 27 22:13:06 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit fa64ba356a4d259a001c77e877f1bb8b60c65442
Author: Robin Appelman <icewind at owncloud.com>
Date:   Fri Feb 27 14:14:42 2015 +0100

    Allow disabling the cache updater
---
 lib/private/files/cache/updater.php | 21 ++++++++++++++++++++-
 lib/private/files/view.php          |  7 +++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/lib/private/files/cache/updater.php b/lib/private/files/cache/updater.php
index 2ddee57..09040e9 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,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) {
 		$this->propagator->addChange($path);
 		$this->propagator->propagateChanges($time);
@@ -42,7 +55,7 @@ class Updater {
 	 * @param int $time
 	 */
 	public function update($path, $time = null) {
-		if (Scanner::isPartialFile($path)) {
+		if (!$this->enabled or Scanner::isPartialFile($path)) {
 			return;
 		}
 		/**
@@ -67,6 +80,9 @@ class Updater {
 	 * @param string $path
 	 */
 	public function remove($path) {
+		if (!$this->enabled) {
+			return;
+		}
 		/**
 		 * @var \OC\Files\Storage\Storage $storage
 		 * @var string $internalPath
@@ -91,6 +107,9 @@ class Updater {
 	 * @param string $target
 	 */
 	public function rename($source, $target) {
+		if (!$this->enabled) {
+			return;
+		}
 		/**
 		 * @var \OC\Files\Storage\Storage $sourceStorage
 		 * @var \OC\Files\Storage\Storage $targetStorage
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index d877d8d..b5ad425 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -1408,4 +1408,11 @@ class View {
 			$mount
 		);
 	}
+
+	/**
+	 * @return Updater
+	 */
+	public function getUpdater(){
+		return $this->updater;
+	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list