iappconfig.php 3.3 KB

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