IAppConfig.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bart Visscher <bartv@thisnet.nl>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Robin Appelman <robin@icewind.nl>
  9. * @author Robin McCorkell <robin@mccorkell.me.uk>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCP;
  27. /**
  28. * This class provides an easy way for apps to store config values in the
  29. * database.
  30. * @since 7.0.0
  31. */
  32. interface IAppConfig {
  33. /**
  34. * check if a key is set in the appconfig
  35. * @param string $app
  36. * @param string $key
  37. * @return bool
  38. * @since 7.0.0
  39. */
  40. public function hasKey($app, $key);
  41. /**
  42. * Gets the config value
  43. * @param string $app app
  44. * @param string $key key
  45. * @param string $default = null, default value if the key does not exist
  46. * @return string the value or $default
  47. * @deprecated 8.0.0 use method getAppValue of \OCP\IConfig
  48. *
  49. * This function gets a value from the appconfig table. If the key does
  50. * not exist the default value will be returned
  51. * @since 7.0.0
  52. */
  53. public function getValue($app, $key, $default = null);
  54. /**
  55. * Deletes a key
  56. * @param string $app app
  57. * @param string $key key
  58. * @return bool
  59. * @deprecated 8.0.0 use method deleteAppValue of \OCP\IConfig
  60. * @since 7.0.0
  61. */
  62. public function deleteKey($app, $key);
  63. /**
  64. * Get the available keys for an app
  65. * @param string $app the app we are looking for
  66. * @return array an array of key names
  67. * @deprecated 8.0.0 use method getAppKeys of \OCP\IConfig
  68. *
  69. * This function gets all keys of an app. Please note that the values are
  70. * not returned.
  71. * @since 7.0.0
  72. */
  73. public function getKeys($app);
  74. /**
  75. * get multiply values, either the app or key can be used as wildcard by setting it to false
  76. *
  77. * @param string|false $key
  78. * @param string|false $app
  79. * @return array|false
  80. * @since 7.0.0
  81. */
  82. public function getValues($app, $key);
  83. /**
  84. * get all values of the app or and filters out sensitive data
  85. *
  86. * @param string $app
  87. * @return array
  88. * @since 12.0.0
  89. */
  90. public function getFilteredValues($app);
  91. /**
  92. * sets a value in the appconfig
  93. * @param string $app app
  94. * @param string $key key
  95. * @param string|float|int $value value
  96. * @deprecated 8.0.0 use method setAppValue of \OCP\IConfig
  97. *
  98. * Sets a value. If the key did not exist before it will be created.
  99. * @return void
  100. * @since 7.0.0
  101. */
  102. public function setValue($app, $key, $value);
  103. /**
  104. * Get all apps using the config
  105. * @return array an array of app ids
  106. *
  107. * This function returns a list of all apps that have at least one
  108. * entry in the appconfig table.
  109. * @since 7.0.0
  110. */
  111. public function getApps();
  112. /**
  113. * Remove app from appconfig
  114. * @param string $app app
  115. * @return bool
  116. * @deprecated 8.0.0 use method deleteAppValue of \OCP\IConfig
  117. *
  118. * Removes all keys in appconfig belonging to the app.
  119. * @since 7.0.0
  120. */
  121. public function deleteApp($app);
  122. }