1
0

IManager.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Lukas Reschke <lukas@statuscode.ch>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  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
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\Settings;
  25. /**
  26. * @since 9.1
  27. */
  28. interface IManager {
  29. /**
  30. * @since 9.1.0
  31. */
  32. const KEY_ADMIN_SETTINGS = 'admin';
  33. /**
  34. * @since 9.1.0
  35. */
  36. const KEY_ADMIN_SECTION = 'admin-section';
  37. /**
  38. * @since 13.0.0
  39. */
  40. const KEY_PERSONAL_SETTINGS = 'personal';
  41. /**
  42. * @since 13.0.0
  43. */
  44. const KEY_PERSONAL_SECTION = 'personal-section';
  45. /**
  46. * sets up settings according to data specified by an apps info.xml, within
  47. * the <settings> element.
  48. *
  49. * @param array $settings an associative array, allowed keys are as specified
  50. * by the KEY_ constant of this interface. The value
  51. * must always be a class name, implement either
  52. * IAdmin or ISection. I.e. only one section and admin
  53. * setting can be configured per app.
  54. * @since 9.1.0
  55. */
  56. public function setupSettings(array $settings);
  57. /**
  58. * attempts to remove an apps section and/or settings entry. A listener is
  59. * added centrally making sure that this method is called ones an app was
  60. * disabled.
  61. *
  62. * What this does not help with is when applications change their settings
  63. * or section classes during their life time. New entries will be added,
  64. * but inactive ones will still reside in the database.
  65. *
  66. * @param string $appId
  67. * @since 9.1.0
  68. */
  69. public function onAppDisabled($appId);
  70. /**
  71. * The method should check all registered classes whether they are still
  72. * instantiable and remove them, if not. This method is called by a
  73. * background job once, after one or more apps were updated.
  74. *
  75. * An app`s info.xml can change during an update and make it unknown whether
  76. * a registered class name was changed or not. An old one would just stay
  77. * registered. Another case is if an admin takes a radical approach and
  78. * simply removes an app from the app folder. These unregular checks will
  79. * take care of such situations.
  80. *
  81. * @since 9.1.0
  82. */
  83. public function checkForOrphanedClassNames();
  84. /**
  85. * returns a list of the admin sections
  86. *
  87. * @return array array of ISection[] where key is the priority
  88. * @since 9.1.0
  89. */
  90. public function getAdminSections();
  91. /**
  92. * returns a list of the personal sections
  93. *
  94. * @return array array of ISection[] where key is the priority
  95. * @since 13.0.0
  96. */
  97. public function getPersonalSections();
  98. /**
  99. * returns a list of the admin settings
  100. *
  101. * @param string $section the section id for which to load the settings
  102. * @return array array of IAdmin[] where key is the priority
  103. * @since 9.1.0
  104. */
  105. public function getAdminSettings($section);
  106. /**
  107. * returns a list of the personal settings
  108. *
  109. * @param string $section the section id for which to load the settings
  110. * @return array array of IPersonal[] where key is the priority
  111. * @since 13.0.0
  112. */
  113. public function getPersonalSettings($section);
  114. }