systemconfig.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * @author Joas Schilling <nickvergessen@owncloud.com>
  4. * @author Morris Jobke <hey@morrisjobke.de>
  5. *
  6. * @copyright Copyright (c) 2015, ownCloud, Inc.
  7. * @license AGPL-3.0
  8. *
  9. * This code is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License, version 3,
  11. * as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License, version 3,
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. namespace OC;
  23. /**
  24. * Class which provides access to the system config values stored in config.php
  25. * Internal class for bootstrap only.
  26. * fixes cyclic DI: AllConfig needs AppConfig needs Database needs AllConfig
  27. */
  28. class SystemConfig {
  29. /**
  30. * Sets a new system wide value
  31. *
  32. * @param string $key the key of the value, under which will be saved
  33. * @param mixed $value the value that should be stored
  34. */
  35. public function setValue($key, $value) {
  36. \OC_Config::setValue($key, $value);
  37. }
  38. /**
  39. * Sets and deletes values and writes the config.php
  40. *
  41. * @param array $configs Associative array with `key => value` pairs
  42. * If value is null, the config key will be deleted
  43. */
  44. public function setValues(array $configs) {
  45. \OC_Config::setValues($configs);
  46. }
  47. /**
  48. * Looks up a system wide defined value
  49. *
  50. * @param string $key the key of the value, under which it was saved
  51. * @param mixed $default the default value to be returned if the value isn't set
  52. * @return mixed the value or $default
  53. */
  54. public function getValue($key, $default = '') {
  55. return \OC_Config::getValue($key, $default);
  56. }
  57. /**
  58. * Delete a system wide defined value
  59. *
  60. * @param string $key the key of the value, under which it was saved
  61. */
  62. public function deleteValue($key) {
  63. \OC_Config::deleteKey($key);
  64. }
  65. }