2014-11-27 15:40:12 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-03-26 10:44:34 +00:00
|
|
|
* @author Joas Schilling <nickvergessen@owncloud.com>
|
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
2014-11-27 15:40:12 +00:00
|
|
|
*
|
2015-03-26 10:44:34 +00:00
|
|
|
* @copyright Copyright (c) 2015, ownCloud, Inc.
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2014-11-27 15:40:12 +00:00
|
|
|
*
|
|
|
|
*/
|
2015-02-26 10:37:37 +00:00
|
|
|
|
2014-11-27 15:40:12 +00:00
|
|
|
namespace OC;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which provides access to the system config values stored in config.php
|
|
|
|
* Internal class for bootstrap only.
|
|
|
|
* fixes cyclic DI: AllConfig needs AppConfig needs Database needs AllConfig
|
|
|
|
*/
|
|
|
|
class SystemConfig {
|
2015-04-30 13:48:31 +00:00
|
|
|
/**
|
|
|
|
* Lists all available config keys
|
|
|
|
* @return array an array of key names
|
|
|
|
*/
|
|
|
|
public function getKeys() {
|
|
|
|
return \OC_Config::getKeys();
|
|
|
|
}
|
|
|
|
|
2014-11-27 15:40:12 +00:00
|
|
|
/**
|
|
|
|
* Sets a new system wide value
|
|
|
|
*
|
|
|
|
* @param string $key the key of the value, under which will be saved
|
|
|
|
* @param mixed $value the value that should be stored
|
|
|
|
*/
|
|
|
|
public function setValue($key, $value) {
|
|
|
|
\OC_Config::setValue($key, $value);
|
|
|
|
}
|
|
|
|
|
2015-01-23 09:50:25 +00:00
|
|
|
/**
|
|
|
|
* Sets and deletes values and writes the config.php
|
|
|
|
*
|
|
|
|
* @param array $configs Associative array with `key => value` pairs
|
|
|
|
* If value is null, the config key will be deleted
|
|
|
|
*/
|
|
|
|
public function setValues(array $configs) {
|
|
|
|
\OC_Config::setValues($configs);
|
|
|
|
}
|
|
|
|
|
2014-11-27 15:40:12 +00:00
|
|
|
/**
|
|
|
|
* Looks up a system wide defined value
|
|
|
|
*
|
|
|
|
* @param string $key the key of the value, under which it was saved
|
|
|
|
* @param mixed $default the default value to be returned if the value isn't set
|
|
|
|
* @return mixed the value or $default
|
|
|
|
*/
|
|
|
|
public function getValue($key, $default = '') {
|
|
|
|
return \OC_Config::getValue($key, $default);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete a system wide defined value
|
|
|
|
*
|
|
|
|
* @param string $key the key of the value, under which it was saved
|
|
|
|
*/
|
|
|
|
public function deleteValue($key) {
|
|
|
|
\OC_Config::deleteKey($key);
|
|
|
|
}
|
|
|
|
}
|