diff options
-rw-r--r-- | apps/settings/lib/Controller/CommonSettingsTrait.php | 8 | ||||
-rw-r--r-- | apps/settings/lib/Search/SectionSearch.php | 7 | ||||
-rw-r--r-- | apps/theming/tests/ServicesTest.php | 4 | ||||
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 1 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 1 | ||||
-rw-r--r-- | lib/private/Settings/Manager.php | 17 | ||||
-rw-r--r-- | lib/public/Settings/IIconSection.php | 32 | ||||
-rw-r--r-- | lib/public/Settings/ISection.php | 60 |
8 files changed, 43 insertions, 87 deletions
diff --git a/apps/settings/lib/Controller/CommonSettingsTrait.php b/apps/settings/lib/Controller/CommonSettingsTrait.php index 20e0ef4a24f..4ad3d7497e9 100644 --- a/apps/settings/lib/Controller/CommonSettingsTrait.php +++ b/apps/settings/lib/Controller/CommonSettingsTrait.php @@ -34,7 +34,6 @@ use OCP\IGroupManager; use OCP\INavigationManager; use OCP\IUser; use OCP\IUserSession; -use OCP\Settings\IIconSection; use OCP\Settings\IManager as ISettingsManager; use OCP\Settings\ISettings; @@ -84,7 +83,7 @@ trait CommonSettingsTrait { protected function formatSections($sections, $currentSection, $type, $currentType, bool $subAdminOnly = false) { $templateParameters = []; - /** @var \OCP\Settings\ISection[] $prioritizedSections */ + /** @var \OCP\Settings\IIconSection[] $prioritizedSections */ foreach ($sections as $prioritizedSections) { foreach ($prioritizedSections as $section) { if ($type === 'admin') { @@ -96,10 +95,7 @@ trait CommonSettingsTrait { continue; } - $icon = ''; - if ($section instanceof IIconSection) { - $icon = $section->getIcon(); - } + $icon = $section->getIcon(); $active = $section->getID() === $currentSection && $type === $currentType; diff --git a/apps/settings/lib/Search/SectionSearch.php b/apps/settings/lib/Search/SectionSearch.php index 67dc0f5d156..e9cd9615db7 100644 --- a/apps/settings/lib/Search/SectionSearch.php +++ b/apps/settings/lib/Search/SectionSearch.php @@ -35,7 +35,7 @@ use OCP\Search\IProvider; use OCP\Search\ISearchQuery; use OCP\Search\SearchResult; use OCP\Search\SearchResultEntry; -use OCP\Settings\ISection; +use OCP\Settings\IIconSection; use OCP\Settings\IManager; class SectionSearch implements IProvider { @@ -117,7 +117,7 @@ class SectionSearch implements IProvider { /** * @param ISearchQuery $query - * @param ISection[][] $sections + * @param IIconSection[][] $sections * @param string $subline * @param string $routeName * @return array @@ -135,10 +135,7 @@ class SectionSearch implements IProvider { /** * We can't use the icon URL at the moment as they don't invert correctly for dark theme - * $iconUrl = ''; - * if ($section instanceof IIconSection) { * $iconUrl = $section->getIcon(); - * } */ $result[] = new SearchResultEntry( diff --git a/apps/theming/tests/ServicesTest.php b/apps/theming/tests/ServicesTest.php index ce893c8cccb..2705c7a4ece 100644 --- a/apps/theming/tests/ServicesTest.php +++ b/apps/theming/tests/ServicesTest.php @@ -34,7 +34,7 @@ use OCA\Theming\Util; use OCP\AppFramework\App; use OCP\Capabilities\ICapability; use OCP\IL10N; -use OCP\Settings\ISection; +use OCP\Settings\IIconSection; use OCP\Settings\ISettings; use Test\TestCase; @@ -75,7 +75,7 @@ class ServicesTest extends TestCase { [Admin::class], [Admin::class, ISettings::class], [Section::class], - [Section::class, ISection::class], + [Section::class, IIconSection::class], ]; } diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index b3080a117dc..e35969f3e80 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -463,7 +463,6 @@ return array( 'OCP\\Session\\Exceptions\\SessionNotAvailableException' => $baseDir . '/lib/public/Session/Exceptions/SessionNotAvailableException.php', 'OCP\\Settings\\IIconSection' => $baseDir . '/lib/public/Settings/IIconSection.php', 'OCP\\Settings\\IManager' => $baseDir . '/lib/public/Settings/IManager.php', - 'OCP\\Settings\\ISection' => $baseDir . '/lib/public/Settings/ISection.php', 'OCP\\Settings\\ISettings' => $baseDir . '/lib/public/Settings/ISettings.php', 'OCP\\Settings\\ISubAdminSettings' => $baseDir . '/lib/public/Settings/ISubAdminSettings.php', 'OCP\\Share' => $baseDir . '/lib/public/Share.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 02698a4f6e2..65f6f96d464 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -492,7 +492,6 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\Session\\Exceptions\\SessionNotAvailableException' => __DIR__ . '/../../..' . '/lib/public/Session/Exceptions/SessionNotAvailableException.php', 'OCP\\Settings\\IIconSection' => __DIR__ . '/../../..' . '/lib/public/Settings/IIconSection.php', 'OCP\\Settings\\IManager' => __DIR__ . '/../../..' . '/lib/public/Settings/IManager.php', - 'OCP\\Settings\\ISection' => __DIR__ . '/../../..' . '/lib/public/Settings/ISection.php', 'OCP\\Settings\\ISettings' => __DIR__ . '/../../..' . '/lib/public/Settings/ISettings.php', 'OCP\\Settings\\ISubAdminSettings' => __DIR__ . '/../../..' . '/lib/public/Settings/ISubAdminSettings.php', 'OCP\\Share' => __DIR__ . '/../../..' . '/lib/public/Share.php', diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 65193e2cac8..37a87a40725 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -38,8 +38,8 @@ use OCP\ILogger; use OCP\IServerContainer; use OCP\IURLGenerator; use OCP\L10N\IFactory; +use OCP\Settings\IIconSection; use OCP\Settings\IManager; -use OCP\Settings\ISection; use OCP\Settings\ISettings; use OCP\Settings\ISubAdminSettings; @@ -80,7 +80,7 @@ class Manager implements IManager { /** * @param string $type 'admin' or 'personal' - * @param string $section Class must implement OCP\Settings\ISection + * @param string $section Class must implement OCP\Settings\IIconSection * * @return void */ @@ -95,7 +95,7 @@ class Manager implements IManager { /** * @param string $type 'admin' or 'personal' * - * @return ISection[] + * @return IIconSection[] */ protected function getSections(string $type): array { if (!isset($this->sections[$type])) { @@ -108,18 +108,13 @@ class Manager implements IManager { foreach (array_unique($this->sectionClasses[$type]) as $index => $class) { try { - /** @var ISection $section */ + /** @var IIconSection $section */ $section = \OC::$server->query($class); } catch (QueryException $e) { $this->log->logException($e, ['level' => ILogger::INFO]); continue; } - if (!$section instanceof ISection) { - $this->log->logException(new \InvalidArgumentException('Invalid settings section registered'), ['level' => ILogger::INFO]); - continue; - } - $sectionID = $section->getID(); if ($sectionID !== 'connected-accounts' && isset($this->sections[$type][$sectionID])) { @@ -212,7 +207,7 @@ class Manager implements IManager { $appSections = $this->getSections('admin'); foreach ($appSections as $section) { - /** @var ISection $section */ + /** @var IIconSection $section */ if (!isset($sections[$section->getPriority()])) { $sections[$section->getPriority()] = []; } @@ -269,7 +264,7 @@ class Manager implements IManager { $appSections = $this->getSections('personal'); foreach ($appSections as $section) { - /** @var ISection $section */ + /** @var IIconSection $section */ if (!isset($sections[$section->getPriority()])) { $sections[$section->getPriority()] = []; } diff --git a/lib/public/Settings/IIconSection.php b/lib/public/Settings/IIconSection.php index 91abe96bc62..1c51b26f27a 100644 --- a/lib/public/Settings/IIconSection.php +++ b/lib/public/Settings/IIconSection.php @@ -2,7 +2,9 @@ /** * @copyright Copyright (c) 2017, Joas Schilling <coding@schilljs.com> * + * @author Arthur Schiwon <blizzz@arthur-schiwon.de> * @author Joas Schilling <coding@schilljs.com> + * @author Lukas Reschke <lukas@statuscode.ch> * * @license GNU AGPL version 3 or any later version * @@ -26,7 +28,35 @@ namespace OCP\Settings; /** * @since 12 */ -interface IIconSection extends ISection { +interface IIconSection { + /** + * returns the ID of the section. It is supposed to be a lower case string, + * e.g. 'ldap' + * + * @returns string + * @since 9.1 + */ + public function getID(); + + /** + * returns the translated name as it should be displayed, e.g. 'LDAP / AD + * integration'. Use the L10N service to translate it. + * + * @return string + * @since 9.1 + */ + public function getName(); + + /** + * @return int whether the form should be rather on the top or bottom of + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. + * + * E.g.: 70 + * @since 9.1 + */ + public function getPriority(); + /** * returns the relative path to an 16*16 icon describing the section. * e.g. '/core/img/places/files.svg' diff --git a/lib/public/Settings/ISection.php b/lib/public/Settings/ISection.php deleted file mode 100644 index ae27638f12a..00000000000 --- a/lib/public/Settings/ISection.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de> - * - * @author Arthur Schiwon <blizzz@arthur-schiwon.de> - * @author Joas Schilling <coding@schilljs.com> - * @author Lukas Reschke <lukas@statuscode.ch> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OCP\Settings; - -/** - * @deprecated 12 Use IIconSection instead - * @since 9.1 - */ -interface ISection { - /** - * returns the ID of the section. It is supposed to be a lower case string, - * e.g. 'ldap' - * - * @returns string - * @since 9.1 - */ - public function getID(); - - /** - * returns the translated name as it should be displayed, e.g. 'LDAP / AD - * integration'. Use the L10N service to translate it. - * - * @return string - * @since 9.1 - */ - public function getName(); - - /** - * @return int whether the form should be rather on the top or bottom of - * the settings navigation. The sections are arranged in ascending order of - * the priority values. It is required to return a value between 0 and 99. - * - * E.g.: 70 - * @since 9.1 - */ - public function getPriority(); -} |