Skip to content
Snippets Groups Projects
Commit bede2c44 authored by Oliver Bartsch's avatar Oliver Bartsch Committed by Benni Mack
Browse files

[TASK] Avoid GeneralUtility::_GET() in EXT:indexed_search

The AdministrationController in EXT:indexed_search is based
on the extbase framework. As this provides a specific request
object, there is no need to use GeneralUtility::_GET() for
fetching plugin related arguments.

However, since the extbase specific request object does not
provide non-plugin related arguments (those without the plugin
prefix), we currently have to fetch them from the global PSR-7
request. This will vanish as soon as extbase does also use the
PSR-7 implementation.

Resolves: #94071
Releases: master
Change-Id: Ib5bd533b2a2bb9283dda11e0a796f3dfd629458f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69034


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent 3f5328aa
Branches
Tags
No related merge requests found
......@@ -16,6 +16,7 @@
namespace TYPO3\CMS\IndexedSearch\Controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\BackendTemplateView;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
......@@ -153,7 +154,7 @@ class AdministrationController extends ActionController
*/
public function initializeAction()
{
$this->pageUid = (int)GeneralUtility::_GET('id');
$this->pageUid = (int)($this->getServerRequest()->getQueryParams()['id'] ?? 0);
$this->indexerConfig = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('indexed_search');
$this->enableMetaphoneSearch = (bool)$this->indexerConfig['enableMetaphoneSearch'];
$this->indexer = GeneralUtility::makeInstance(Indexer::class);
......@@ -169,11 +170,11 @@ class AdministrationController extends ActionController
*/
public function processRequest(RequestInterface $request): ResponseInterface
{
$vars = GeneralUtility::_GET('tx_indexedsearch_web_indexedsearchisearch');
$arguments = $request->getArguments();
$beUser = $this->getBackendUserAuthentication();
if (is_array($vars) && isset($vars['action']) && method_exists($this, $vars['action'] . 'Action')) {
$action = $vars['action'];
if (is_array($arguments) && isset($arguments['action']) && method_exists($this, $arguments['action'] . 'Action')) {
$action = $arguments['action'];
switch ($action) {
case 'saveStopwordsKeywords':
......@@ -185,7 +186,7 @@ class AdministrationController extends ActionController
}
$beUser->uc['indexed_search']['action'] = $action;
$beUser->uc['indexed_search']['arguments'] = $request->getArguments();
$beUser->uc['indexed_search']['arguments'] = $arguments;
$beUser->writeUC();
} elseif (isset($beUser->uc['indexed_search']['action'])) {
if ($request instanceof Request) {
......@@ -555,4 +556,18 @@ class AdministrationController extends ActionController
{
return $GLOBALS['LANG'];
}
/**
* We currently rely on the PSR-7 request next to the extbase specific
* implementation, since we have to access non-prefixed query arguments.
* See initializeAction(), which fetches the `id` (UID of the selected
* page in the page tree).
*
* @return ServerRequestInterface
* @todo Remove as soon as extbase uses the PSR-7 request
*/
protected function getServerRequest(): ServerRequestInterface
{
return $GLOBALS['TYPO3_REQUEST'];
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment