allconfig.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. *
  8. */
  9. namespace OC;
  10. /**
  11. * Class to combine all the configuration options ownCloud offers
  12. */
  13. class AllConfig implements \OCP\IConfig {
  14. /**
  15. * Sets a new system wide value
  16. *
  17. * @param string $key the key of the value, under which will be saved
  18. * @param mixed $value the value that should be stored
  19. * @todo need a use case for this
  20. */
  21. // public function setSystemValue($key, $value) {
  22. // \OCP\Config::setSystemValue($key, $value);
  23. // }
  24. /**
  25. * Looks up a system wide defined value
  26. *
  27. * @param string $key the key of the value, under which it was saved
  28. * @param mixed $default the default value to be returned if the value isn't set
  29. * @return string the saved value
  30. */
  31. public function getSystemValue($key, $default = '') {
  32. return \OCP\Config::getSystemValue($key, $default);
  33. }
  34. /**
  35. * Writes a new app wide value
  36. *
  37. * @param string $appName the appName that we want to store the value under
  38. * @param string $key the key of the value, under which will be saved
  39. * @param string $value the value that should be stored
  40. */
  41. public function setAppValue($appName, $key, $value) {
  42. \OCP\Config::setAppValue($appName, $key, $value);
  43. }
  44. /**
  45. * Looks up an app wide defined value
  46. *
  47. * @param string $appName the appName that we stored the value under
  48. * @param string $key the key of the value, under which it was saved
  49. * @param string $default the default value to be returned if the value isn't set
  50. * @return string the saved value
  51. */
  52. public function getAppValue($appName, $key, $default = '') {
  53. return \OCP\Config::getAppValue($appName, $key, $default);
  54. }
  55. /**
  56. * Set a user defined value
  57. *
  58. * @param string $userId the userId of the user that we want to store the value under
  59. * @param string $appName the appName that we want to store the value under
  60. * @param string $key the key under which the value is being stored
  61. * @param string $value the value that you want to store
  62. */
  63. public function setUserValue($userId, $appName, $key, $value) {
  64. \OCP\Config::setUserValue($userId, $appName, $key, $value);
  65. }
  66. /**
  67. * Shortcut for getting a user defined value
  68. *
  69. * @param string $userId the userId of the user that we want to store the value under
  70. * @param string $appName the appName that we stored the value under
  71. * @param string $key the key under which the value is being stored
  72. * @param string $default the default value to be returned if the value isn't set
  73. * @return string
  74. */
  75. public function getUserValue($userId, $appName, $key, $default = '') {
  76. return \OCP\Config::getUserValue($userId, $appName, $key, $default);
  77. }
  78. }