From ff1f341d9776401f4e68a5de12b546ca26f229d1 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 22 May 2014 13:30:32 +0200 Subject: [PATCH 1/2] Fix phpdoc --- lib/private/files/cache/watcher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/files/cache/watcher.php b/lib/private/files/cache/watcher.php index 599752a6ef..5a4f53fb73 100644 --- a/lib/private/files/cache/watcher.php +++ b/lib/private/files/cache/watcher.php @@ -45,7 +45,7 @@ class Watcher { } /** - * @param int $policy either \OC\Files\Cache\Watcher::UPDATE_NEVER, \OC\Files\Cache\Watcher::UPDATE_ONCE, \OC\Files\Cache\Watcher::UPDATE_ALWAYS + * @param int $policy either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS */ public function setPolicy($policy) { $this->watchPolicy = $policy; From 151c48494e0e1c6b8bed2551c50196a67284db0c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 22 May 2014 13:45:55 +0200 Subject: [PATCH 2/2] Add a config option fro setting the filesystem watcher policy --- config/config.sample.php | 11 ++++++++++- lib/private/files/storage/common.php | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/config/config.sample.php b/config/config.sample.php index 708e836702..80694837ed 100755 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -283,5 +283,14 @@ $CONFIG = array( * cache directory and "$user" is the user. * */ -'cache_path' => '' +'cache_path' => '', + +/* + * specifies how often the filesystem is checked for changes made outside owncloud + * 0 -> never check the filesystem for outside changes, provides a performance increase when it's certain that no changes are made directly to the filesystem + * 1 -> check each file or folder at most once per request, recomended for general use if outside changes might happen + * 2 -> check every time the filesystem is used, causes a performance hit when using external storages, not recomended for regular use + */ +'filesystem_check_changes' => 1 + ); diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index fef33cabd8..45db51c165 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -7,6 +7,7 @@ */ namespace OC\Files\Storage; +use OC\Files\Cache\Watcher; /** * Storage backend class for providing common filesystem operation methods @@ -276,6 +277,7 @@ abstract class Common implements \OC\Files\Storage\Storage { public function getWatcher($path = '') { if (!isset($this->watcher)) { $this->watcher = new \OC\Files\Cache\Watcher($this); + $this->watcher->setPolicy(\OC::$server->getConfig()->getSystemValue('filesystem_check_changes', Watcher::CHECK_ONCE)); } return $this->watcher; }