Merge pull request #8674 from owncloud/watch-policy
Add a config option for setting the filesystem watcher policy
This commit is contained in:
commit
48d0cebc42
3 changed files with 13 additions and 2 deletions
|
@ -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
|
||||
|
||||
);
|
||||
|
|
2
lib/private/files/cache/watcher.php
vendored
2
lib/private/files/cache/watcher.php
vendored
|
@ -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;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
|
||||
namespace OC\Files\Storage;
|
||||
use OC\Files\Cache\Watcher;
|
||||
|
||||
/**
|
||||
* Storage backend class for providing common filesystem operation methods
|
||||
|
@ -280,6 +281,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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue