[TASK] Rename ImageManipulationWizard to ImageManipulationController 16/56316/4
authorMathias Brodala <mbrodala@pagemachine.de>
Sat, 17 Mar 2018 14:55:08 +0000 (15:55 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 17 Mar 2018 16:28:32 +0000 (17:28 +0100)
Change-Id: Ibb5038049780edcf70aae442b9f9933feeed5589
Resolves: #84409
Releases: master
Reviewed-on: https://review.typo3.org/56316
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Controller/Wizard/ImageManipulationController.php [new file with mode: 0644]
typo3/sysext/backend/Classes/Form/Wizard/ImageManipulationWizard.php [deleted file]
typo3/sysext/backend/Configuration/Backend/AjaxRoutes.php
typo3/sysext/backend/Migrations/Code/ClassAliasMap.php
typo3/sysext/backend/Migrations/Code/LegacyClassesForIde.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-84399-ClassRecordListRenamedToRecordListController.rst
typo3/sysext/core/Documentation/Changelog/master/Deprecation-84409-ImageManipulationWizardRenamedToImageManipulationController.rst [new file with mode: 0644]
typo3/sysext/core/Documentation/Changelog/master/Deprecation-84410-CodeCompletionRenamedToCodeCompletionController.rst
typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php

diff --git a/typo3/sysext/backend/Classes/Controller/Wizard/ImageManipulationController.php b/typo3/sysext/backend/Classes/Controller/Wizard/ImageManipulationController.php
new file mode 100644 (file)
index 0000000..6728719
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+declare(strict_types = 1);
+namespace TYPO3\CMS\Backend\Controller\Wizard;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use TYPO3\CMS\Core\Http\HtmlResponse;
+use TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException;
+use TYPO3\CMS\Core\Resource\ResourceFactory;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\MathUtility;
+use TYPO3\CMS\Fluid\View\StandaloneView;
+
+/**
+ * Wizard for rendering image manipulation view
+ */
+class ImageManipulationController
+{
+    /**
+     * @var StandaloneView
+     */
+    private $templateView;
+
+    /**
+     * @param StandaloneView $templateView
+     */
+    public function __construct(StandaloneView $templateView = null)
+    {
+        if (!$templateView) {
+            $templateView = GeneralUtility::makeInstance(StandaloneView::class);
+            $templateView->setLayoutRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Layouts/')]);
+            $templateView->setPartialRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Partials/ImageManipulation/')]);
+            $templateView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/ImageManipulation/ImageManipulationWizard.html'));
+        }
+        $this->templateView = $templateView;
+    }
+
+    /**
+     * Returns the HTML for the wizard inside the modal
+     *
+     * @param ServerRequestInterface $request
+     * @return ResponseInterface $response
+     */
+    public function getWizardContent(ServerRequestInterface $request): ResponseInterface
+    {
+        if ($this->isSignatureValid($request)) {
+            $queryParams = json_decode($request->getQueryParams()['arguments'], true);
+            $fileUid = $queryParams['image'];
+            $image = null;
+            if (MathUtility::canBeInterpretedAsInteger($fileUid)) {
+                try {
+                    $image = ResourceFactory::getInstance()->getFileObject($fileUid);
+                } catch (FileDoesNotExistException $e) {
+                }
+            }
+            $viewData = [
+                'image' => $image,
+                'cropVariants' => $queryParams['cropVariants']
+            ];
+            $content = $this->templateView->renderSection('Main', $viewData);
+            return new HtmlResponse($content);
+        }
+        return new HtmlResponse('', 403);
+    }
+
+    /**
+     * Check if hmac signature is correct
+     *
+     * @param ServerRequestInterface $request the request with the GET parameters
+     * @return bool
+     */
+    protected function isSignatureValid(ServerRequestInterface $request): bool
+    {
+        $token = GeneralUtility::hmac($request->getQueryParams()['arguments'], 'ajax_wizard_image_manipulation');
+        return hash_equals($token, $request->getQueryParams()['signature']);
+    }
+}
diff --git a/typo3/sysext/backend/Classes/Form/Wizard/ImageManipulationWizard.php b/typo3/sysext/backend/Classes/Form/Wizard/ImageManipulationWizard.php
deleted file mode 100644 (file)
index 69ce4d1..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?php
-declare(strict_types = 1);
-namespace TYPO3\CMS\Backend\Form\Wizard;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use Psr\Http\Message\ResponseInterface;
-use Psr\Http\Message\ServerRequestInterface;
-use TYPO3\CMS\Core\Http\HtmlResponse;
-use TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException;
-use TYPO3\CMS\Core\Resource\ResourceFactory;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Core\Utility\MathUtility;
-use TYPO3\CMS\Fluid\View\StandaloneView;
-
-/**
- * Wizard for rendering image manipulation view
- */
-class ImageManipulationWizard
-{
-    /**
-     * @var StandaloneView
-     */
-    private $templateView;
-
-    /**
-     * @param StandaloneView $templateView
-     */
-    public function __construct(StandaloneView $templateView = null)
-    {
-        if (!$templateView) {
-            $templateView = GeneralUtility::makeInstance(StandaloneView::class);
-            $templateView->setLayoutRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Layouts/')]);
-            $templateView->setPartialRootPaths([GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Partials/ImageManipulation/')]);
-            $templateView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/ImageManipulation/ImageManipulationWizard.html'));
-        }
-        $this->templateView = $templateView;
-    }
-
-    /**
-     * Returns the HTML for the wizard inside the modal
-     *
-     * @param ServerRequestInterface $request
-     * @return ResponseInterface $response
-     */
-    public function getWizardAction(ServerRequestInterface $request): ResponseInterface
-    {
-        if ($this->isSignatureValid($request)) {
-            $queryParams = json_decode($request->getQueryParams()['arguments'], true);
-            $fileUid = $queryParams['image'];
-            $image = null;
-            if (MathUtility::canBeInterpretedAsInteger($fileUid)) {
-                try {
-                    $image = ResourceFactory::getInstance()->getFileObject($fileUid);
-                } catch (FileDoesNotExistException $e) {
-                }
-            }
-            $viewData = [
-                'image' => $image,
-                'cropVariants' => $queryParams['cropVariants']
-            ];
-            $content = $this->templateView->renderSection('Main', $viewData);
-            return new HtmlResponse($content);
-        }
-        return new HtmlResponse('', 403);
-    }
-
-    /**
-     * Check if hmac signature is correct
-     *
-     * @param ServerRequestInterface $request the request with the GET parameters
-     * @return bool
-     */
-    protected function isSignatureValid(ServerRequestInterface $request)
-    {
-        $token = GeneralUtility::hmac($request->getQueryParams()['arguments'], 'ajax_wizard_image_manipulation');
-        return hash_equals($token, $request->getQueryParams()['signature']);
-    }
-}
index cca5646..b9ac917 100644 (file)
@@ -201,7 +201,7 @@ return [
     // Open the image manipulation wizard
     'wizard_image_manipulation' => [
         'path' => '/wizard/image-manipulation',
-        'target' => \TYPO3\CMS\Backend\Form\Wizard\ImageManipulationWizard::class . '::getWizardAction'
+        'target' => \TYPO3\CMS\Backend\Controller\Wizard\ImageManipulationController::class . '::getWizardContent'
     ],
 
     // Save a newly added online media
index f759d9c..81b11a5 100644 (file)
@@ -1,4 +1,5 @@
 <?php
 return [
     'TYPO3\\CMS\\Backend\\AjaxLoginHandler' => \TYPO3\CMS\Backend\Controller\AjaxLoginController::class,
+    'TYPO3\\CMS\\Backend\\Form\\Wizard\\ImageManipulationWizard' => \TYPO3\CMS\Backend\Controller\Wizard\ImageManipulationController::class,
 ];
index 72f2dfe..d19be3d 100644 (file)
@@ -4,7 +4,19 @@ namespace {
 }
 
 namespace TYPO3\CMS\Backend {
+    /**
+     * @deprecated since v9, will be removed in v10
+     */
     class AjaxLoginHandler extends \TYPO3\CMS\Backend\Controller\AjaxLoginController
     {
     }
 }
+
+namespace TYPO3\CMS\Backend\Form\Wizard {
+    /**
+     * @deprecated since v9, will be removed in v10
+     */
+    class ImageManipulationWizard extends \TYPO3\CMS\Backend\Controller\Wizard\ImageManipulationController
+    {
+    }
+}
index cf965eb..1b6450a 100644 (file)
@@ -17,7 +17,7 @@ Impact
 ======
 
 The old class name has been registered as class alias and will still work.
-Old class name usage however is discouraged and should be avoided since, the
+Old class name usage however is discouraged and should be avoided, the
 alias will vanish with core version 10.
 
 
@@ -35,4 +35,4 @@ Migration
 
 Use new class name instead.
 
-.. index:: Backend, PHP-API, FullyScanned, ext:recordlist
\ No newline at end of file
+.. index:: Backend, PHP-API, FullyScanned, ext:recordlist
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84409-ImageManipulationWizardRenamedToImageManipulationController.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-84409-ImageManipulationWizardRenamedToImageManipulationController.rst
new file mode 100644 (file)
index 0000000..d3ce148
--- /dev/null
@@ -0,0 +1,35 @@
+.. include:: ../../Includes.txt
+
+====================================================================================
+Deprecation: #84409 - ImageManipulationWizard renamed to ImageManipulationController
+====================================================================================
+
+See :issue:`84409`
+
+Description
+===========
+
+The PHP class :php:`TYPO3\CMS\Backend\Form\Wizard\ImageManipulationWizard` has been renamed to
+:php:`TYPO3\CMS\Backend\Controller\Wizard\ImageManipulationController`.
+
+
+Impact
+======
+
+The old class name has been registered as class alias and will still work.
+Old class name usage however is discouraged and should be avoided, the
+alias will vanish with core version 10.
+
+
+Affected Installations
+======================
+
+Extensions which use the old class name are affected. The extension scanner will find affected extensions using the old class name.
+
+
+Migration
+=========
+
+Use new class name instead.
+
+.. index:: Backend, PHP-API, FullyScanned
index 2644cd0..af5fb62 100644 (file)
@@ -17,7 +17,7 @@ Impact
 ======
 
 The old class name has been registered as class alias and will still work.
-Old class name usage however is discouraged and should be avoided since, the
+Old class name usage however is discouraged and should be avoided, the
 alias will vanish with core version 10.
 
 
@@ -32,4 +32,4 @@ Migration
 
 Use new class name instead.
 
-.. index:: Backend, PHP-API, FullyScanned, ext:t3editor
\ No newline at end of file
+.. index:: Backend, PHP-API, FullyScanned, ext:t3editor
index a2f024d..61dfed7 100644 (file)
@@ -664,4 +664,9 @@ return [
             'Deprecation-84410-CodeCompletionRenamedToCodeCompletionController.rst',
         ],
     ],
+    'TYPO3\CMS\Backend\Form\Wizard\ImageManipulationWizard' => [
+        'restFiles' => [
+            'Deprecation-84409-ImageManipulationWizardRenamedToImageManipulationController.rst',
+        ],
+    ],
 ];