]> source.dussan.org Git - nextcloud-server.git/commitdiff
rename IAdmin to ISettings, the interface is not bound to a specific settings scope
authorArthur Schiwon <blizzz@arthur-schiwon.de>
Thu, 11 Aug 2016 12:48:21 +0000 (14:48 +0200)
committerLukas Reschke <lukas@statuscode.ch>
Tue, 16 Aug 2016 19:05:54 +0000 (21:05 +0200)
12 files changed:
apps/encryption/lib/Settings/Admin.php
apps/updatenotification/lib/Controller/AdminController.php
apps/user_ldap/lib/Settings/Admin.php
lib/private/Settings/Admin/Encryption.php
lib/private/Settings/Admin/Logging.php
lib/private/Settings/Admin/Server.php
lib/private/Settings/Admin/Sharing.php
lib/private/Settings/Admin/TipsTricks.php
lib/private/Settings/Manager.php
lib/public/Settings/IAdmin.php [deleted file]
lib/public/Settings/ISettings.php [new file with mode: 0644]
settings/Controller/AdminSettingsController.php

index 71a365caee194977a87964bfa183ff62bae724ce..2faa118e2a2485bad51990844b7e0a7baf3ceaee 100644 (file)
@@ -33,10 +33,10 @@ use OCP\ILogger;
 use OCP\ISession;
 use OCP\IUserManager;
 use OCP\IUserSession;
-use OCP\Settings\IAdmin;
+use OCP\Settings\ISettings;
 use OCP\IConfig;
 
-class Admin implements IAdmin {
+class Admin implements ISettings {
 
        /** @var IL10N */
        private $l;
index 5f137120435e12c2d04e01e3cf57de0cf14affca..3c6ab4630599a1bc16fa3cad4e660e23313b936b 100644 (file)
@@ -34,9 +34,9 @@ use OCP\IDateTimeFormatter;
 use OCP\IL10N;
 use OCP\IRequest;
 use OCP\Security\ISecureRandom;
-use OCP\Settings\IAdmin;
+use OCP\Settings\ISettings;
 
-class AdminController extends Controller implements IAdmin {
+class AdminController extends Controller implements ISettings {
        /** @var IJobList */
        private $jobList;
        /** @var ISecureRandom */
index f155f1cec8de43136b53c0d0e1bac546d7c81a6d..606cfe6cf0194bc082c394cb14c11cab51ba5d1a 100644 (file)
@@ -27,10 +27,10 @@ use OCA\User_LDAP\Configuration;
 use OCA\User_LDAP\Helper;
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\IL10N;
-use OCP\Settings\IAdmin;
+use OCP\Settings\ISettings;
 use OCP\Template;
 
-class Admin implements IAdmin {
+class Admin implements ISettings {
 
        /** @var IL10N */
        private $l;
index 331ddf5452053cb3a77df676bca6b41dc1279be5..ceae5aa6d3fd52a93e8595810d34b24ff2c093c4 100644 (file)
@@ -26,9 +26,9 @@ namespace OC\Settings\Admin;
 use OC\Encryption\Manager;
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\IUserManager;
-use OCP\Settings\IAdmin;
+use OCP\Settings\ISettings;
 
-class Encryption implements IAdmin {
+class Encryption implements ISettings {
        /** @var Manager */
        private $manager;
 
index b05ea93388df565fde9b47e8b1e3fd70815dff9e..3097070577dd7eb1fad3d5d5390d9f0d807d03ab 100644 (file)
@@ -26,9 +26,9 @@ namespace OC\Settings\Admin;
 use OC\Log\File as LogFile;
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\IConfig;
-use OCP\Settings\IAdmin;
+use OCP\Settings\ISettings;
 
-class Logging implements IAdmin {
+class Logging implements ISettings {
        /** @var IConfig */
        private $config;
 
index ee2da154da2c23a8a2871640bd18577647896a36..4f1edcf469105bac1da684fa9ec71f86649243cf 100644 (file)
@@ -29,9 +29,9 @@ use Doctrine\DBAL\Platforms\SqlitePlatform;
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\IConfig;
 use OCP\IDBConnection;
-use OCP\Settings\IAdmin;
+use OCP\Settings\ISettings;
 
-class Server implements IAdmin {
+class Server implements ISettings {
 
        /** @var IDBConnection|Connection */
        private $db;
index 088021f9057c09304aa9670ae6d1d186e2683c46..d186dbed9814bd0cedd9efca4fd59935ff80622d 100644 (file)
@@ -25,9 +25,9 @@ namespace OC\Settings\Admin;
 
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\IConfig;
-use OCP\Settings\IAdmin;
+use OCP\Settings\ISettings;
 
-class Sharing implements IAdmin {
+class Sharing implements ISettings {
        /** @var IConfig */
        private $config;
 
index 331c33db1c17602818121cf13d6dd8c6dbe98c67..217ddacd44307ec05e6c25d6b5b2f517c3b69646 100644 (file)
@@ -25,9 +25,9 @@ namespace OC\Settings\Admin;
 
 use OCP\AppFramework\Http\TemplateResponse;
 use OCP\IConfig;
-use OCP\Settings\IAdmin;
+use OCP\Settings\ISettings;
 
-class TipsTricks implements IAdmin {
+class TipsTricks implements ISettings {
        /** @var IConfig */
        private $config;
 
index fa762003c1d0e03094e156f2e96a7fdabb4efe15..4c96dd07fde8f46ae358fc53f47923860bda90c2 100644 (file)
@@ -30,7 +30,7 @@ use OCP\IDBConnection;
 use OCP\IL10N;
 use OCP\ILogger;
 use OCP\IUserManager;
-use OCP\Settings\IAdmin;
+use OCP\Settings\ISettings;
 use OCP\Settings\IManager;
 use OCP\Settings\ISection;
 
@@ -119,7 +119,7 @@ class Manager implements IManager {
                ]);
        }
 
-       private function addAdminSettings(IAdmin $settings) {
+       private function addAdminSettings(ISettings $settings) {
                $this->add(self::TABLE_ADMIN_SETTINGS, [
                        'class' => get_class($settings),
                        'section' => $settings->getSection(),
@@ -136,7 +136,7 @@ class Manager implements IManager {
                $query->execute();
        }
 
-       private function updateAdminSettings(IAdmin $settings) {
+       private function updateAdminSettings(ISettings $settings) {
                $this->update(
                        self::TABLE_ADMIN_SETTINGS,
                        'class',
@@ -210,14 +210,14 @@ class Manager implements IManager {
                }
 
                try {
-                       /** @var IAdmin $settings */
+                       /** @var ISettings $settings */
                        $settings = $this->query($settingsClassName);
                } catch (QueryException $e) {
                        // cancel
                        return;
                }
 
-               if(!$settings instanceof IAdmin) {
+               if(!$settings instanceof ISettings) {
                        $this->log->error(
                                'Admin section instance must implement \OCP\ISection. Invalid class: {class}',
                                ['class' => $settingsClassName]
@@ -283,27 +283,27 @@ class Manager implements IManager {
                $forms = [];
                try {
                        if($section === 'server') {
-                               /** @var IAdmin $form */
+                               /** @var ISettings $form */
                                $form = new Admin\Server($this->dbc, $this->config);
                                $forms[$form->getPriority()] = [$form];
                        }
                        if($section === 'encryption') {
-                               /** @var IAdmin $form */
+                               /** @var ISettings $form */
                                $form = new Admin\Encryption($this->encryptionManager, $this->userManager);
                                $forms[$form->getPriority()] = [$form];
                        }
                        if($section === 'sharing') {
-                               /** @var IAdmin $form */
+                               /** @var ISettings $form */
                                $form = new Admin\Sharing($this->config);
                                $forms[$form->getPriority()] = [$form];
                        }
                        if($section === 'logging') {
-                               /** @var IAdmin $form */
+                               /** @var ISettings $form */
                                $form = new Admin\Logging($this->config);
                                $forms[$form->getPriority()] = [$form];
                        }
                        if($section === 'tips-tricks') {
-                               /** @var IAdmin $form */
+                               /** @var ISettings $form */
                                $form = new Admin\TipsTricks($this->config);
                                $forms[$form->getPriority()] = [$form];
                        }
diff --git a/lib/public/Settings/IAdmin.php b/lib/public/Settings/IAdmin.php
deleted file mode 100644 (file)
index 7497725..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @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;
-
-use OCP\AppFramework\Http\TemplateResponse;
-
-interface IAdmin {
-
-       /**
-        * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
-        */
-       public function getForm();
-
-       /**
-        * @return string the section ID, e.g. 'sharing'
-        */
-       public function getSection();
-
-       /**
-        * @return int whether the form should be rather on the top or bottom of
-        * the admin section. The forms are arranged in ascending order of the
-        * priority values. It is required to return a value between 0 and 100.
-        *
-        * E.g.: 70
-        */
-       public function getPriority();
-}
diff --git a/lib/public/Settings/ISettings.php b/lib/public/Settings/ISettings.php
new file mode 100644 (file)
index 0000000..07d265a
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/**
+ * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @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;
+
+use OCP\AppFramework\Http\TemplateResponse;
+
+interface ISettings {
+
+       /**
+        * @return TemplateResponse returns the instance with all parameters set, ready to be rendered
+        * @since 9.1
+        */
+       public function getForm();
+
+       /**
+        * @return string the section ID, e.g. 'sharing'
+        * @since 9.1
+        */
+       public function getSection();
+
+       /**
+        * @return int whether the form should be rather on the top or bottom of
+        * the admin section. The forms are arranged in ascending order of the
+        * priority values. It is required to return a value between 0 and 100.
+        *
+        * E.g.: 70
+        * @since 9.1
+        */
+       public function getPriority();
+}
index f27bdd3ec3304700d6c7f164574e124f1716f17a..271aa05265bac483893799b046666c40dcd64734 100644 (file)
@@ -91,7 +91,7 @@ class AdminSettingsController extends Controller {
                $html = '';
                foreach ($settings as $prioritizedSettings) {
                        foreach ($prioritizedSettings as $setting) {
-                               /** @var \OCP\Settings\IAdmin $setting */
+                               /** @var \OCP\Settings\ISettings $setting */
                                $form = $setting->getForm();
                                $html .= $form->renderAs('')->render();
                        }