systemconfig.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Morris Jobke <hey@morrisjobke.de>
  4. * 2013 Bart Visscher <bartv@thisnet.nl>
  5. *
  6. * This file is licensed under the Affero General Public License version 3 or
  7. * later.
  8. * See the COPYING-README file.
  9. *
  10. */
  11. namespace OC;
  12. /**
  13. * Class which provides access to the system config values stored in config.php
  14. * Internal class for bootstrap only.
  15. * fixes cyclic DI: AllConfig needs AppConfig needs Database needs AllConfig
  16. */
  17. class SystemConfig {
  18. /**
  19. * Sets a new system wide value
  20. *
  21. * @param string $key the key of the value, under which will be saved
  22. * @param mixed $value the value that should be stored
  23. */
  24. public function setValue($key, $value) {
  25. \OC_Config::setValue($key, $value);
  26. }
  27. /**
  28. * Sets and deletes values and writes the config.php
  29. *
  30. * @param array $configs Associative array with `key => value` pairs
  31. * If value is null, the config key will be deleted
  32. */
  33. public function setValues(array $configs) {
  34. \OC_Config::setValues($configs);
  35. }
  36. /**
  37. * Looks up a system wide defined value
  38. *
  39. * @param string $key the key of the value, under which it was saved
  40. * @param mixed $default the default value to be returned if the value isn't set
  41. * @return mixed the value or $default
  42. */
  43. public function getValue($key, $default = '') {
  44. return \OC_Config::getValue($key, $default);
  45. }
  46. /**
  47. * Delete a system wide defined value
  48. *
  49. * @param string $key the key of the value, under which it was saved
  50. */
  51. public function deleteValue($key) {
  52. \OC_Config::deleteKey($key);
  53. }
  54. }