iappconfig.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 <rmccorkell@karoshi.org.uk>
  7. * @author Scrutinizer Auto-Fixer <auto-fixer@scrutinizer-ci.com>
  8. *
  9. * @copyright Copyright (c) 2015, ownCloud, Inc.
  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. */
  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. */
  37. public function hasKey($app, $key);
  38. /**
  39. * Gets the config value
  40. * @param string $app app
  41. * @param string $key key
  42. * @param string $default = null, default value if the key does not exist
  43. * @return string the value or $default
  44. * @deprecated use method getAppValue of \OCP\IConfig
  45. *
  46. * This function gets a value from the appconfig table. If the key does
  47. * not exist the default value will be returned
  48. */
  49. public function getValue($app, $key, $default = null);
  50. /**
  51. * Deletes a key
  52. * @param string $app app
  53. * @param string $key key
  54. * @return bool
  55. * @deprecated use method deleteAppValue of \OCP\IConfig
  56. */
  57. public function deleteKey($app, $key);
  58. /**
  59. * Get the available keys for an app
  60. * @param string $app the app we are looking for
  61. * @return array an array of key names
  62. * @deprecated use method getAppKeys of \OCP\IConfig
  63. *
  64. * This function gets all keys of an app. Please note that the values are
  65. * not returned.
  66. */
  67. public function getKeys($app);
  68. /**
  69. * get multiply values, either the app or key can be used as wildcard by setting it to false
  70. *
  71. * @param string|false $key
  72. * @param string|false $app
  73. * @return array|false
  74. */
  75. public function getValues($app, $key);
  76. /**
  77. * sets a value in the appconfig
  78. * @param string $app app
  79. * @param string $key key
  80. * @param string $value value
  81. * @deprecated use method setAppValue of \OCP\IConfig
  82. *
  83. * Sets a value. If the key did not exist before it will be created.
  84. * @return void
  85. */
  86. public function setValue($app, $key, $value);
  87. /**
  88. * Get all apps using the config
  89. * @return array an array of app ids
  90. *
  91. * This function returns a list of all apps that have at least one
  92. * entry in the appconfig table.
  93. */
  94. public function getApps();
  95. /**
  96. * Remove app from appconfig
  97. * @param string $app app
  98. * @return bool
  99. * @deprecated use method deleteAppValue of \OCP\IConfig
  100. *
  101. * Removes all keys in appconfig belonging to the app.
  102. */
  103. public function deleteApp($app);
  104. }