]> source.dussan.org Git - nextcloud-server.git/commitdiff
Remove ISection in favor of IIconSection 23770/head
authorMorris Jobke <hey@morrisjobke.de>
Wed, 28 Oct 2020 21:51:49 +0000 (22:51 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Wed, 28 Oct 2020 22:05:00 +0000 (23:05 +0100)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
apps/settings/lib/Controller/CommonSettingsTrait.php
apps/settings/lib/Search/SectionSearch.php
apps/theming/tests/ServicesTest.php
lib/composer/composer/autoload_classmap.php
lib/composer/composer/autoload_static.php
lib/private/Settings/Manager.php
lib/public/Settings/IIconSection.php
lib/public/Settings/ISection.php [deleted file]

index 20e0ef4a24f9391d339f884e6ae924e2e8fa687f..4ad3d7497e96c269ba748532ac6549825fa0528f 100644 (file)
@@ -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;
index 67dc0f5d1565e268c45ef541264140269474d04e..e9cd9615db75b31d57a7340aeb7635ff1cde5bdc 100644 (file)
@@ -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(
index ce893c8cccb998bd884334573db3ef66b93277af..2705c7a4ece3aad6e2060970fe45ac327a86fd75 100644 (file)
@@ -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],
                ];
        }
 
index b3080a117dcd5a93fb58035cb8c11ee4f1d34e2e..e35969f3e80a97d4c3871b2ddcf0c36febaa4e05 100644 (file)
@@ -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',
index 02698a4f6e24e20fd3d2c79f4a1f95c2982e8d13..65f6f96d4640049b2aa22a5d83f1bc233c747528 100644 (file)
@@ -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',
index 65193e2cac8e01418b106a29461e636785f15019..37a87a40725fb33eb5effc4b9010285aaa470676 100644 (file)
@@ -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()] = [];
                        }
index 91abe96bc62712bb9aff71c58d94c58ddb44a877..1c51b26f27a3e4bd5fc3dda62a7f8287f2ca205e 100644 (file)
@@ -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 (file)
index ae27638..0000000
+++ /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();
-}