You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IAppConfig.php 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. * sets a value in the appconfig
  85. * @param string $app app
  86. * @param string $key key
  87. * @param string|float|int $value value
  88. * @deprecated 8.0.0 use method setAppValue of \OCP\IConfig
  89. *
  90. * Sets a value. If the key did not exist before it will be created.
  91. * @return void
  92. * @since 7.0.0
  93. */
  94. public function setValue($app, $key, $value);
  95. /**
  96. * Get all apps using the config
  97. * @return array an array of app ids
  98. *
  99. * This function returns a list of all apps that have at least one
  100. * entry in the appconfig table.
  101. * @since 7.0.0
  102. */
  103. public function getApps();
  104. /**
  105. * Remove app from appconfig
  106. * @param string $app app
  107. * @return bool
  108. * @deprecated 8.0.0 use method deleteAppValue of \OCP\IConfig
  109. *
  110. * Removes all keys in appconfig belonging to the app.
  111. * @since 7.0.0
  112. */
  113. public function deleteApp($app);
  114. }