diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-06-19 01:16:53 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-06-19 23:03:07 +0200 |
commit | 3706eae7771367196c53085a1e6352ab0ef885c4 (patch) | |
tree | 35a149540af01dc7ae444de4cc6d1f84944b4f22 | |
parent | 4cff3a3a86b726f1863da9196d8a7cb2a425785f (diff) | |
download | nextcloud-server-3706eae7771367196c53085a1e6352ab0ef885c4.tar.gz nextcloud-server-3706eae7771367196c53085a1e6352ab0ef885c4.zip |
flow to not use deprecated event dispatcher methods
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
-rw-r--r-- | apps/workflowengine/lib/AppInfo/Application.php | 9 | ||||
-rw-r--r-- | apps/workflowengine/lib/Settings/ASettings.php | 22 | ||||
-rw-r--r-- | lib/composer/composer/autoload_classmap.php | 1 | ||||
-rw-r--r-- | lib/composer/composer/autoload_static.php | 1 | ||||
-rw-r--r-- | lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php | 34 |
5 files changed, 50 insertions, 17 deletions
diff --git a/apps/workflowengine/lib/AppInfo/Application.php b/apps/workflowengine/lib/AppInfo/Application.php index a92f3567853..04922a7e9d4 100644 --- a/apps/workflowengine/lib/AppInfo/Application.php +++ b/apps/workflowengine/lib/AppInfo/Application.php @@ -25,19 +25,20 @@ use OCA\WorkflowEngine\Controller\RequestTime; use OCA\WorkflowEngine\Helper\LogContext; use OCA\WorkflowEngine\Manager; use OCA\WorkflowEngine\Service\Logger; +use OCP\AppFramework\App; use OCP\AppFramework\QueryException; use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Template; use OCP\WorkflowEngine\IEntity; use OCP\WorkflowEngine\IEntityCompat; use OCP\WorkflowEngine\IOperation; use OCP\WorkflowEngine\IOperationCompat; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -class Application extends \OCP\AppFramework\App { +class Application extends App { public const APP_ID = 'workflowengine'; - /** @var EventDispatcherInterface */ + /** @var IEventDispatcher */ protected $dispatcher; /** @var Manager */ protected $manager; @@ -47,7 +48,7 @@ class Application extends \OCP\AppFramework\App { $this->getContainer()->registerAlias('RequestTimeController', RequestTime::class); - $this->dispatcher = $this->getContainer()->getServer()->getEventDispatcher(); + $this->dispatcher = $this->getContainer()->getServer()->query(IEventDispatcher::class); $this->manager = $this->getContainer()->query(Manager::class); } diff --git a/apps/workflowengine/lib/Settings/ASettings.php b/apps/workflowengine/lib/Settings/ASettings.php index a3f2ad2495f..3d704e662ee 100644 --- a/apps/workflowengine/lib/Settings/ASettings.php +++ b/apps/workflowengine/lib/Settings/ASettings.php @@ -28,17 +28,18 @@ namespace OCA\WorkflowEngine\Settings; use OCA\WorkflowEngine\AppInfo\Application; use OCA\WorkflowEngine\Manager; use OCP\AppFramework\Http\TemplateResponse; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IInitialStateService; use OCP\IL10N; use OCP\Settings\ISettings; +use OCP\WorkflowEngine\Events\LoadSettingsScriptsEvent; use OCP\WorkflowEngine\ICheck; use OCP\WorkflowEngine\IComplexOperation; use OCP\WorkflowEngine\IEntity; use OCP\WorkflowEngine\IEntityEvent; use OCP\WorkflowEngine\IOperation; use OCP\WorkflowEngine\ISpecificOperation; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; abstract class ASettings implements ISettings { /** @var IL10N */ @@ -47,7 +48,7 @@ abstract class ASettings implements ISettings { /** @var string */ private $appName; - /** @var EventDispatcherInterface */ + /** @var IEventDispatcher */ private $eventDispatcher; /** @var Manager */ @@ -59,18 +60,10 @@ abstract class ASettings implements ISettings { /** @var IConfig */ private $config; - /** - * @param string $appName - * @param IL10N $l - * @param EventDispatcherInterface $eventDispatcher - * @param Manager $manager - * @param IInitialStateService $initialStateService - * @param IConfig $config - */ public function __construct( - $appName, + string $appName, IL10N $l, - EventDispatcherInterface $eventDispatcher, + IEventDispatcher $eventDispatcher, Manager $manager, IInitialStateService $initialStateService, IConfig $config @@ -89,7 +82,10 @@ abstract class ASettings implements ISettings { * @return TemplateResponse */ public function getForm() { - $this->eventDispatcher->dispatch('OCP\WorkflowEngine::loadAdditionalSettingScripts'); + $this->eventDispatcher->dispatch( + 'OCP\WorkflowEngine::loadAdditionalSettingScripts', + new LoadSettingsScriptsEvent() + ); $entities = $this->manager->getEntitiesList(); $this->initialStateService->provideInitialState( diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 930a14df5d5..982fef9abb9 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -512,6 +512,7 @@ return array( 'OCP\\WorkflowEngine\\EntityContext\\IDisplayText' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IDisplayText.php', 'OCP\\WorkflowEngine\\EntityContext\\IIcon' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IIcon.php', 'OCP\\WorkflowEngine\\EntityContext\\IUrl' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IUrl.php', + 'OCP\\WorkflowEngine\\Events\\LoadSettingsScriptsEvent' => $baseDir . '/lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php', 'OCP\\WorkflowEngine\\Events\\RegisterChecksEvent' => $baseDir . '/lib/public/WorkflowEngine/Events/RegisterChecksEvent.php', 'OCP\\WorkflowEngine\\Events\\RegisterEntitiesEvent' => $baseDir . '/lib/public/WorkflowEngine/Events/RegisterEntitiesEvent.php', 'OCP\\WorkflowEngine\\Events\\RegisterOperationsEvent' => $baseDir . '/lib/public/WorkflowEngine/Events/RegisterOperationsEvent.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 9539dbc1a4b..c4067088659 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -541,6 +541,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\WorkflowEngine\\EntityContext\\IDisplayText' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IDisplayText.php', 'OCP\\WorkflowEngine\\EntityContext\\IIcon' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IIcon.php', 'OCP\\WorkflowEngine\\EntityContext\\IUrl' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IUrl.php', + 'OCP\\WorkflowEngine\\Events\\LoadSettingsScriptsEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php', 'OCP\\WorkflowEngine\\Events\\RegisterChecksEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/Events/RegisterChecksEvent.php', 'OCP\\WorkflowEngine\\Events\\RegisterEntitiesEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/Events/RegisterEntitiesEvent.php', 'OCP\\WorkflowEngine\\Events\\RegisterOperationsEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/Events/RegisterOperationsEvent.php', diff --git a/lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php b/lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php new file mode 100644 index 00000000000..56fddc84031 --- /dev/null +++ b/lib/public/WorkflowEngine/Events/LoadSettingsScriptsEvent.php @@ -0,0 +1,34 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020 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\WorkflowEngine\Events; + +use OCP\EventDispatcher\Event; + +/** + * @since 20.0.0 + */ +class LoadSettingsScriptsEvent extends Event { +} |