From efb7448cd271f7f0cd21fd284fd1d3f9d729f20f Mon Sep 17 00:00:00 2001 From: jld3103 Date: Mon, 19 Jun 2023 07:48:44 +0200 Subject: workflowengine: Stop using a service alias for controller Signed-off-by: jld3103 --- .../composer/composer/autoload_classmap.php | 2 +- .../composer/composer/autoload_static.php | 2 +- apps/workflowengine/lib/AppInfo/Application.php | 2 - apps/workflowengine/lib/Controller/RequestTime.php | 54 ---------------------- .../lib/Controller/RequestTimeController.php | 54 ++++++++++++++++++++++ .../src/components/Checks/request.js | 2 +- 6 files changed, 57 insertions(+), 59 deletions(-) delete mode 100644 apps/workflowengine/lib/Controller/RequestTime.php create mode 100644 apps/workflowengine/lib/Controller/RequestTimeController.php (limited to 'apps/workflowengine') diff --git a/apps/workflowengine/composer/composer/autoload_classmap.php b/apps/workflowengine/composer/composer/autoload_classmap.php index 39a6c6c4703..0444cce13e7 100644 --- a/apps/workflowengine/composer/composer/autoload_classmap.php +++ b/apps/workflowengine/composer/composer/autoload_classmap.php @@ -23,7 +23,7 @@ return array( 'OCA\\WorkflowEngine\\Command\\Index' => $baseDir . '/../lib/Command/Index.php', 'OCA\\WorkflowEngine\\Controller\\AWorkflowController' => $baseDir . '/../lib/Controller/AWorkflowController.php', 'OCA\\WorkflowEngine\\Controller\\GlobalWorkflowsController' => $baseDir . '/../lib/Controller/GlobalWorkflowsController.php', - 'OCA\\WorkflowEngine\\Controller\\RequestTime' => $baseDir . '/../lib/Controller/RequestTime.php', + 'OCA\\WorkflowEngine\\Controller\\RequestTimeController' => $baseDir . '/../lib/Controller/RequestTimeController.php', 'OCA\\WorkflowEngine\\Controller\\UserWorkflowsController' => $baseDir . '/../lib/Controller/UserWorkflowsController.php', 'OCA\\WorkflowEngine\\Entity\\File' => $baseDir . '/../lib/Entity/File.php', 'OCA\\WorkflowEngine\\Helper\\LogContext' => $baseDir . '/../lib/Helper/LogContext.php', diff --git a/apps/workflowengine/composer/composer/autoload_static.php b/apps/workflowengine/composer/composer/autoload_static.php index e867bfa4feb..0b9ac89ae30 100644 --- a/apps/workflowengine/composer/composer/autoload_static.php +++ b/apps/workflowengine/composer/composer/autoload_static.php @@ -38,7 +38,7 @@ class ComposerStaticInitWorkflowEngine 'OCA\\WorkflowEngine\\Command\\Index' => __DIR__ . '/..' . '/../lib/Command/Index.php', 'OCA\\WorkflowEngine\\Controller\\AWorkflowController' => __DIR__ . '/..' . '/../lib/Controller/AWorkflowController.php', 'OCA\\WorkflowEngine\\Controller\\GlobalWorkflowsController' => __DIR__ . '/..' . '/../lib/Controller/GlobalWorkflowsController.php', - 'OCA\\WorkflowEngine\\Controller\\RequestTime' => __DIR__ . '/..' . '/../lib/Controller/RequestTime.php', + 'OCA\\WorkflowEngine\\Controller\\RequestTimeController' => __DIR__ . '/..' . '/../lib/Controller/RequestTimeController.php', 'OCA\\WorkflowEngine\\Controller\\UserWorkflowsController' => __DIR__ . '/..' . '/../lib/Controller/UserWorkflowsController.php', 'OCA\\WorkflowEngine\\Entity\\File' => __DIR__ . '/..' . '/../lib/Entity/File.php', 'OCA\\WorkflowEngine\\Helper\\LogContext' => __DIR__ . '/..' . '/../lib/Helper/LogContext.php', diff --git a/apps/workflowengine/lib/AppInfo/Application.php b/apps/workflowengine/lib/AppInfo/Application.php index 19ff530f2ae..ddf6bf30af6 100644 --- a/apps/workflowengine/lib/AppInfo/Application.php +++ b/apps/workflowengine/lib/AppInfo/Application.php @@ -27,7 +27,6 @@ namespace OCA\WorkflowEngine\AppInfo; use Closure; -use OCA\WorkflowEngine\Controller\RequestTime; use OCA\WorkflowEngine\Helper\LogContext; use OCA\WorkflowEngine\Listener\LoadAdditionalSettingsScriptsListener; use OCA\WorkflowEngine\Manager; @@ -53,7 +52,6 @@ class Application extends App implements IBootstrap { } public function register(IRegistrationContext $context): void { - $context->registerServiceAlias('RequestTimeController', RequestTime::class); $context->registerEventListener( LoadSettingsScriptsEvent::class, LoadAdditionalSettingsScriptsListener::class, diff --git a/apps/workflowengine/lib/Controller/RequestTime.php b/apps/workflowengine/lib/Controller/RequestTime.php deleted file mode 100644 index a1d9ff4a630..00000000000 --- a/apps/workflowengine/lib/Controller/RequestTime.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * @author Joas Schilling - * @author Morris Jobke - * - * @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 OCA\WorkflowEngine\Controller; - -use OCP\AppFramework\Controller; -use OCP\AppFramework\Http\JSONResponse; - -class RequestTime extends Controller { - - /** - * @NoAdminRequired - * - * @param string $search - * @return JSONResponse - */ - public function getTimezones($search = '') { - $timezones = \DateTimeZone::listIdentifiers(); - - if ($search !== '') { - $timezones = array_filter($timezones, function ($timezone) use ($search) { - return stripos($timezone, $search) !== false; - }); - } - - $timezones = array_slice($timezones, 0, 10); - - $response = []; - foreach ($timezones as $timezone) { - $response[$timezone] = $timezone; - } - return new JSONResponse($response); - } -} diff --git a/apps/workflowengine/lib/Controller/RequestTimeController.php b/apps/workflowengine/lib/Controller/RequestTimeController.php new file mode 100644 index 00000000000..bb65e020c56 --- /dev/null +++ b/apps/workflowengine/lib/Controller/RequestTimeController.php @@ -0,0 +1,54 @@ + + * + * @author Joas Schilling + * @author Morris Jobke + * + * @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 OCA\WorkflowEngine\Controller; + +use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\JSONResponse; + +class RequestTimeController extends Controller { + + /** + * @NoAdminRequired + * + * @param string $search + * @return JSONResponse + */ + public function getTimezones($search = '') { + $timezones = \DateTimeZone::listIdentifiers(); + + if ($search !== '') { + $timezones = array_filter($timezones, function ($timezone) use ($search) { + return stripos($timezone, $search) !== false; + }); + } + + $timezones = array_slice($timezones, 0, 10); + + $response = []; + foreach ($timezones as $timezone) { + $response[$timezone] = $timezone; + } + return new JSONResponse($response); + } +} diff --git a/apps/workflowengine/src/components/Checks/request.js b/apps/workflowengine/src/components/Checks/request.js index 9f33bac6676..04d2069c7c8 100644 --- a/apps/workflowengine/src/components/Checks/request.js +++ b/apps/workflowengine/src/components/Checks/request.js @@ -38,7 +38,7 @@ const RequestChecks = [ component: RequestURL, }, { - class: 'OCA\\WorkflowEngine\\Check\\RequestTime', + class: 'OCA\\WorkflowEngine\\Check\\RequestTimeController', name: t('workflowengine', 'Request time'), operators: [ { operator: 'in', name: t('workflowengine', 'between') }, -- cgit v1.2.3