From b71de68f438e60925d302a5698cf0a0590e96b00 Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Wed, 24 Jun 2020 13:00:22 +0200 Subject: Cleanup public api methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Dashboard/Manager.php | 8 ++-- lib/public/Dashboard/IManager.php | 6 --- lib/public/Dashboard/IPanel.php | 6 --- lib/public/Dashboard/IRegisterPanelEvent.php | 56 ---------------------------- lib/public/Dashboard/RegisterPanelEvent.php | 56 ++++++++++++++++++++++++++++ 5 files changed, 59 insertions(+), 73 deletions(-) delete mode 100644 lib/public/Dashboard/IRegisterPanelEvent.php create mode 100644 lib/public/Dashboard/RegisterPanelEvent.php (limited to 'lib') diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php index 0d149dc9a13..f9c857f831f 100644 --- a/lib/private/Dashboard/Manager.php +++ b/lib/private/Dashboard/Manager.php @@ -26,6 +26,7 @@ namespace OC\Dashboard; use OCP\AppFramework\QueryException; use OCP\Dashboard\IManager; use OCP\Dashboard\IPanel; +use OCP\ILogger; use OCP\IServerContainer; class Manager implements IManager { @@ -43,10 +44,7 @@ class Manager implements IManager { $this->serverContainer = $serverContainer; } - /** - * @inheritDoc - */ - public function registerPanel(IPanel $panel): void { + private function registerPanel(IPanel $panel): void { if (array_key_exists($panel->getId(), $this->panels)) { throw new \InvalidArgumentException('Dashboard panel with this id has already been registered'); } @@ -86,7 +84,7 @@ class Manager implements IManager { * we can not inject it. Thus the static call. */ \OC::$server->getLogger()->logException($e, [ - 'message' => 'Could not register lazy crash reporter: ' . $e->getMessage(), + 'message' => 'Could not register lazy dashboard panel: ' . $e->getMessage(), 'level' => ILogger::FATAL, ]); } diff --git a/lib/public/Dashboard/IManager.php b/lib/public/Dashboard/IManager.php index 21d67407fb8..51ee7d2fbe5 100644 --- a/lib/public/Dashboard/IManager.php +++ b/lib/public/Dashboard/IManager.php @@ -31,12 +31,6 @@ namespace OCP\Dashboard; */ interface IManager { - /** - * @param IPanel $panel - * @since 20.0.0 - */ - public function registerPanel(IPanel $panel): void; - /** * @param string $panelClass * @since 20.0.0 diff --git a/lib/public/Dashboard/IPanel.php b/lib/public/Dashboard/IPanel.php index 1b0e3c11d1a..d7e7b157964 100644 --- a/lib/public/Dashboard/IPanel.php +++ b/lib/public/Dashboard/IPanel.php @@ -55,12 +55,6 @@ interface IPanel { */ public function getIconClass(): string; - /** - * @return string The absolute path to an icon in SVG - * @since 20.0.0 - */ - public function getIconUrl(): string; - /** * @return string The absolute url to the apps own view * @since 20.0.0 diff --git a/lib/public/Dashboard/IRegisterPanelEvent.php b/lib/public/Dashboard/IRegisterPanelEvent.php deleted file mode 100644 index 1ca42a6f033..00000000000 --- a/lib/public/Dashboard/IRegisterPanelEvent.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * @author Julius Härtl - * - * @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 . - * - */ - -namespace OCP\Dashboard; - -use OCP\EventDispatcher\Event; - -/** - * Class IRegisterPanelEvent - * - * This event is dispatched to allow apps supporting older Nextcloud versions to - * still register their dashboard panels so that they are only constructed when - * they are needed. Deprecated right away so we can drop it again after 19 is EOL - * and backward compatible apps can use OCP\AppFramework\Bootstrap\IBootstrap - * - * @package OCP\Dashboard - * @since 20.0.0 - * @deprecated 20.0.0 - */ -class IRegisterPanelEvent extends Event { - private $manager; - - public function __construct(IManager $manager) { - parent::__construct(); - - $this->manager = $manager; - } - - /** - * @param IPanel $panel - * @since 20.0.0 - */ - public function registerPanel(IPanel $panel) { - $this->manager->registerPanel($panel); - } -} diff --git a/lib/public/Dashboard/RegisterPanelEvent.php b/lib/public/Dashboard/RegisterPanelEvent.php new file mode 100644 index 00000000000..bc0028d5c0c --- /dev/null +++ b/lib/public/Dashboard/RegisterPanelEvent.php @@ -0,0 +1,56 @@ + + * + * @author Julius Härtl + * + * @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 . + * + */ + +namespace OCP\Dashboard; + +use OCP\EventDispatcher\Event; + +/** + * Class RegisterPanelEvent + * + * This event is dispatched to allow apps supporting older Nextcloud versions to + * still register their dashboard panels so that they are only constructed when + * they are needed. Deprecated right away so we can drop it again after 19 is EOL + * and backward compatible apps can use OCP\AppFramework\Bootstrap\IBootstrap + * + * @package OCP\Dashboard + * @since 20.0.0 + * @deprecated 20.0.0 + */ +class RegisterPanelEvent extends Event { + private $manager; + + public function __construct(IManager $manager) { + parent::__construct(); + + $this->manager = $manager; + } + + /** + * @param string $panelClass + * @since 20.0.0 + */ + public function registerPanel(string $panelClass) { + $this->manager->lazyRegisterPanel($panelClass); + } +} -- cgit v1.2.3