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 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace OCP;
  9. /**
  10. * This class provides an easy way for apps to store config values in the
  11. * database.
  12. */
  13. interface IAppConfig {
  14. /**
  15. * check if a key is set in the appconfig
  16. * @param string $app
  17. * @param string $key
  18. * @return bool
  19. */
  20. public function hasKey($app, $key);
  21. /**
  22. * Gets the config value
  23. * @param string $app app
  24. * @param string $key key
  25. * @param string $default = null, default value if the key does not exist
  26. * @return string the value or $default
  27. *
  28. * This function gets a value from the appconfig table. If the key does
  29. * not exist the default value will be returned
  30. */
  31. public function getValue($app, $key, $default = null);
  32. /**
  33. * Deletes a key
  34. * @param string $app app
  35. * @param string $key key
  36. * @return bool
  37. *
  38. * Deletes a key.
  39. */
  40. public function deleteKey($app, $key);
  41. /**
  42. * Get the available keys for an app
  43. * @param string $app the app we are looking for
  44. * @return array an array of key names
  45. *
  46. * This function gets all keys of an app. Please note that the values are
  47. * not returned.
  48. */
  49. public function getKeys($app);
  50. /**
  51. * get multiply values, either the app or key can be used as wildcard by setting it to false
  52. *
  53. * @param string|false $key
  54. * @param string|false $app
  55. * @return array
  56. */
  57. public function getValues($app, $key);
  58. /**
  59. * sets a value in the appconfig
  60. * @param string $app app
  61. * @param string $key key
  62. * @param string $value value
  63. *
  64. * Sets a value. If the key did not exist before it will be created.
  65. * @return void
  66. */
  67. public function setValue($app, $key, $value);
  68. /**
  69. * Get all apps using the config
  70. * @return array an array of app ids
  71. *
  72. * This function returns a list of all apps that have at least one
  73. * entry in the appconfig table.
  74. */
  75. public function getApps();
  76. /**
  77. * Remove app from appconfig
  78. * @param string $app app
  79. * @return bool
  80. *
  81. * Removes all keys in appconfig belonging to the app.
  82. */
  83. public function deleteApp($app);
  84. }