timohund /
ext-solr
| 1 | <?php |
||
| 2 | declare(strict_types=1); |
||
| 3 | namespace ApacheSolrForTypo3\Solr\Controller\Backend; |
||
| 4 | |||
| 5 | /*************************************************************** |
||
| 6 | * Copyright notice |
||
| 7 | * |
||
| 8 | * (c) 2012-2015 Ingo Renner <[email protected]> |
||
| 9 | * All rights reserved |
||
| 10 | * |
||
| 11 | * This script is part of the TYPO3 project. The TYPO3 project is |
||
| 12 | * free software; you can redistribute it and/or modify |
||
| 13 | * it under the terms of the GNU General Public License as published by |
||
| 14 | * the Free Software Foundation; either version 3 of the License, or |
||
| 15 | * (at your option) any later version. |
||
| 16 | * |
||
| 17 | * The GNU General Public License can be found at |
||
| 18 | * http://www.gnu.org/copyleft/gpl.html. |
||
| 19 | * |
||
| 20 | * This script is distributed in the hope that it will be useful, |
||
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 23 | * GNU General Public License for more details. |
||
| 24 | * |
||
| 25 | * This copyright notice MUST APPEAR in all copies of the script! |
||
| 26 | ***************************************************************/ |
||
| 27 | |||
| 28 | use ApacheSolrForTypo3\Solr\ConnectionManager; |
||
| 29 | use Psr\Http\Message\ResponseInterface; |
||
| 30 | use Psr\Http\Message\ServerRequestInterface; |
||
| 31 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
||
| 32 | use TYPO3\CMS\Core\Http\Response; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Handling of Ajax requests |
||
| 36 | */ |
||
| 37 | class AjaxController |
||
| 38 | { |
||
| 39 | /** |
||
| 40 | * Update a single solr connection |
||
| 41 | * |
||
| 42 | * @deprecated Configuring solr connections with TypoScript is deprecated please use the site handling. Will be dropped with EXT:solr 11 |
||
| 43 | * @param ServerRequestInterface $request |
||
| 44 | * @param ResponseInterface $response |
||
| 45 | * @return ResponseInterface |
||
| 46 | */ |
||
| 47 | public function updateConnection(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface |
||
| 48 | { |
||
| 49 | trigger_error('solr:deprecation: Configuring solr connections with TypoScript is deprecated please use the site handling', E_USER_DEPRECATED); |
||
| 50 | |||
| 51 | $queryParams = $request->getQueryParams(); |
||
| 52 | $pageId = 0; |
||
| 53 | if (isset($queryParams['id'])) { |
||
| 54 | $pageId = (int)$queryParams['id']; |
||
| 55 | } |
||
| 56 | |||
| 57 | // Currently no return value from connection manager |
||
| 58 | $content = [ |
||
| 59 | 'success' => true, |
||
| 60 | 'message' => 'Solr connection has been updated' |
||
| 61 | ]; |
||
| 62 | if ($pageId) { |
||
| 63 | $connectionManager = GeneralUtility::makeInstance(ConnectionManager::class); |
||
| 64 | $connectionManager->updateConnectionByRootPageId($pageId); |
||
| 65 | } |
||
| 66 | |||
| 67 | $response->getBody()->write(json_encode($content)); |
||
| 68 | return $response; |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Update all connections |
||
| 73 | * |
||
| 74 | * @deprecated Configuring solr connections with TypoScript is deprecated please use the site handling. Will be dropped with EXT:solr 11 |
||
| 75 | * @param ServerRequestInterface $request |
||
| 76 | * @return ResponseInterface |
||
| 77 | */ |
||
| 78 | public function updateConnections(ServerRequestInterface $request): ResponseInterface |
||
|
0 ignored issues
–
show
|
|||
| 79 | { |
||
| 80 | trigger_error('solr:deprecation: Configuring solr connections with TypoScript is deprecated please use the site handling', E_USER_DEPRECATED); |
||
| 81 | |||
| 82 | $connectionManager = GeneralUtility::makeInstance(ConnectionManager::class); |
||
| 83 | $connectionManager->updateConnections(); |
||
| 84 | // Currently no return value from connection manager |
||
| 85 | return new Response(); |
||
| 86 | } |
||
| 87 | |||
| 88 | } |
||
| 89 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.