diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2015-12-18 11:24:15 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2015-12-18 11:53:41 +0100 |
commit | 0a09004d39b5d27124d59ed45debf109170b24d2 (patch) | |
tree | b58a53749187396ed6ed5a962a15f06c66b071b8 /lib/private | |
parent | 82bf99c0cfd764b25d1442cf199f219cd852ff69 (diff) | |
download | nextcloud-server-0a09004d39b5d27124d59ed45debf109170b24d2.tar.gz nextcloud-server-0a09004d39b5d27124d59ed45debf109170b24d2.zip |
Inject Config into SystemConfig
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/server.php | 7 | ||||
-rw-r--r-- | lib/private/systemconfig.php | 17 |
2 files changed, 16 insertions, 8 deletions
diff --git a/lib/private/server.php b/lib/private/server.php index 8439500706d..3e1af0310d1 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -84,8 +84,9 @@ class Server extends SimpleContainer implements IServerContainer { /** * @param string $webRoot + * @param \OC\Config $config */ - public function __construct($webRoot) { + public function __construct($webRoot, \OC\Config $config) { parent::__construct(); $this->webRoot = $webRoot; @@ -238,8 +239,8 @@ class Server extends SimpleContainer implements IServerContainer { $c->getSystemConfig() ); }); - $this->registerService('SystemConfig', function ($c) { - return new \OC\SystemConfig(); + $this->registerService('SystemConfig', function ($c) use ($config) { + return new \OC\SystemConfig($config); }); $this->registerService('AppConfig', function ($c) { return new \OC\AppConfig(\OC_DB::getConnection()); diff --git a/lib/private/systemconfig.php b/lib/private/systemconfig.php index d2ceeb8272d..fb8c18123d7 100644 --- a/lib/private/systemconfig.php +++ b/lib/private/systemconfig.php @@ -44,12 +44,19 @@ class SystemConfig { 'objectstore' => ['arguments' => ['password' => true]], ]; + /** @var Config */ + private $config; + + public function __construct(Config $config) { + $this->config = $config; + } + /** * Lists all available config keys * @return array an array of key names */ public function getKeys() { - return \OC::$config->getKeys(); + return $this->config->getKeys(); } /** @@ -59,7 +66,7 @@ class SystemConfig { * @param mixed $value the value that should be stored */ public function setValue($key, $value) { - \OC::$config->setValue($key, $value); + $this->config->setValue($key, $value); } /** @@ -69,7 +76,7 @@ class SystemConfig { * If value is null, the config key will be deleted */ public function setValues(array $configs) { - \OC::$config->setValues($configs); + $this->config->setValues($configs); } /** @@ -80,7 +87,7 @@ class SystemConfig { * @return mixed the value or $default */ public function getValue($key, $default = '') { - return \OC::$config->getValue($key, $default); + return $this->config->getValue($key, $default); } /** @@ -106,7 +113,7 @@ class SystemConfig { * @param string $key the key of the value, under which it was saved */ public function deleteValue($key) { - \OC::$config->deleteKey($key); + $this->config->deleteKey($key); } /** |