1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the TYPO3 CMS project. |
7
|
|
|
* |
8
|
|
|
* It is free software; you can redistribute it and/or modify it under |
9
|
|
|
* the terms of the GNU General Public License, either version 2 |
10
|
|
|
* of the License, or any later version. |
11
|
|
|
* |
12
|
|
|
* For the full copyright and license information, please read the |
13
|
|
|
* LICENSE.txt file that was distributed with this source code. |
14
|
|
|
* |
15
|
|
|
* The TYPO3 project - inspiring people to share! |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
namespace ApacheSolrForTypo3\Solr\IndexQueue\FrontendHelper; |
19
|
|
|
|
20
|
|
|
use ApacheSolrForTypo3\Solr\IndexQueue\PageIndexerRequest; |
21
|
|
|
use ApacheSolrForTypo3\Solr\IndexQueue\PageIndexerResponse; |
22
|
|
|
use ApacheSolrForTypo3\Solr\System\Logging\SolrLogManager; |
23
|
|
|
use TYPO3\CMS\Core\SingletonInterface; |
24
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
25
|
|
|
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Index Queue page indexer frontend helper base class implementing common |
29
|
|
|
* functionality. |
30
|
|
|
* |
31
|
|
|
* @author Ingo Renner <[email protected]> |
32
|
|
|
*/ |
33
|
|
|
abstract class AbstractFrontendHelper implements FrontendHelper, SingletonInterface |
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* Index Queue page indexer request. |
37
|
|
|
* |
38
|
|
|
* @var PageIndexerRequest|null |
39
|
|
|
*/ |
40
|
|
|
protected ?PageIndexerRequest $request = null; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Index Queue page indexer response. |
44
|
|
|
* |
45
|
|
|
* @var PageIndexerResponse|null |
46
|
|
|
*/ |
47
|
|
|
protected ?PageIndexerResponse $response = null; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Singleton instance variable for indication of indexing request. |
51
|
|
|
* |
52
|
|
|
* @var bool |
53
|
|
|
*/ |
54
|
|
|
protected bool $isActivated = false; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* The action a frontend helper executes. |
58
|
|
|
*/ |
59
|
|
|
protected string $action; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var SolrLogManager|null |
63
|
|
|
*/ |
64
|
|
|
protected ?SolrLogManager $logger = null; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Starts the execution of a frontend helper. |
68
|
|
|
* |
69
|
|
|
* @param PageIndexerRequest $request Page indexer request |
70
|
|
|
* @param PageIndexerResponse $response Page indexer response |
71
|
|
|
*/ |
72
|
|
|
public function processRequest( |
73
|
|
|
PageIndexerRequest $request, |
74
|
|
|
PageIndexerResponse $response |
75
|
|
|
): void { |
76
|
|
|
$this->request = $request; |
77
|
|
|
$this->response = $response; |
78
|
|
|
$this->logger = GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__); |
79
|
|
|
|
80
|
|
|
if ($request->getParameter('loggingEnabled')) { |
81
|
|
|
$this->logger->log( |
|
|
|
|
82
|
|
|
SolrLogManager::INFO, |
83
|
|
|
'Page indexer request received', |
84
|
|
|
[ |
85
|
|
|
'request' => (array)$request, |
86
|
|
|
] |
87
|
|
|
); |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Deactivates a frontend helper by unregistering from hooks and releasing |
93
|
|
|
* resources. |
94
|
|
|
*/ |
95
|
|
|
public function deactivate(): void |
96
|
|
|
{ |
97
|
|
|
$this->isActivated = false; |
98
|
|
|
$this->response->addActionResult($this->action, $this->getData()); |
|
|
|
|
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.