1
0

iappconfig.php 3.3 KB

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