Skip to content

Commit 192664d

Browse files
bmackdkd-kaehm
authored andcommitted
[!!!][TASK] Remove deprecated functionality
This change removes deprecated features of EXT:solr a) PageDocumentPostProcessor The interface PageDocumentPostProcessor is removed, along with the registration in ext_localconf.php. The PostProcessor is now removed in favor of the PageIndexerDocumentsModifier interface, and can be used already in EXT:solr v11. Check in your extensions' ext_localconf.php and look for `$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['Indexer']['indexPagePostProcessPageDocument']` to see if you are affected. In addition, some rather unintrusive, deprecated methods in UrlHelper have been removed as UrlHelper is just a small extension for UriInterface, and might vanish altogether in the future. Relates: #3376
1 parent 15891e1 commit 192664d

File tree

7 files changed

+11
-272
lines changed

7 files changed

+11
-272
lines changed

Classes/Domain/Index/PageIndexer/Helper/UriBuilder/AbstractUriStrategy.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,22 @@ protected function applyTypoScriptOverridesOnIndexingUrl(UrlHelper $urlHelper, a
4444
{
4545
// check whether we should use ssl / https
4646
if (!empty($overrideConfiguration['scheme'])) {
47-
$urlHelper->setScheme($overrideConfiguration['scheme']);
47+
$urlHelper = $urlHelper->withScheme($overrideConfiguration['scheme']);
4848
}
4949

5050
// overwriting the host
5151
if (!empty($overrideConfiguration['host'])) {
52-
$urlHelper->setHost($overrideConfiguration['host']);
52+
$urlHelper = $urlHelper->withHost($overrideConfiguration['host']);
5353
}
5454

5555
// overwriting the port
5656
if (!empty($overrideConfiguration['port'])) {
57-
$urlHelper->setPort((int)$overrideConfiguration['port']);
57+
$urlHelper = $urlHelper->withPort((int)$overrideConfiguration['port']);
5858
}
5959

6060
// setting a path if TYPO3 is installed in a subdirectory
6161
if (!empty($overrideConfiguration['path'])) {
62-
$urlHelper->setPath($overrideConfiguration['path']);
62+
$urlHelper = $urlHelper->withPath($overrideConfiguration['path']);
6363
}
6464

6565
return $urlHelper;
@@ -75,7 +75,7 @@ public function getPageIndexingUriFromPageItemAndLanguageId(
7575
$urlHelper = GeneralUtility::makeInstance(UrlHelper::class, $pageIndexUri);
7676
$overrideConfiguration = $options['frontendDataHelper.'] ?? [];
7777
$urlHelper = $this->applyTypoScriptOverridesOnIndexingUrl($urlHelper, $overrideConfiguration);
78-
$dataUrl = $urlHelper->getUrl();
78+
$dataUrl = (string)$urlHelper;
7979

8080
if (!GeneralUtility::isValidUrl($dataUrl)) {
8181
$this->logger->log(

Classes/PageDocumentPostProcessor.php

Lines changed: 0 additions & 41 deletions
This file was deleted.

Classes/System/Url/UrlHelper.php

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
namespace ApacheSolrForTypo3\Solr\System\Url;
1717

18-
use InvalidArgumentException;
1918
use TYPO3\CMS\Core\Http\Uri;
2019

2120
/**
@@ -25,57 +24,6 @@
2524
*/
2625
class UrlHelper extends Uri
2726
{
28-
/**
29-
* @deprecated Will be removed with v12. Use withHost instead.
30-
* @see Uri::withHost()
31-
*/
32-
public function setHost(string $host): UrlHelper
33-
{
34-
$this->host = $host;
35-
return $this;
36-
}
37-
38-
/**
39-
* @deprecated Will be removed with v12. Use withPort instead.
40-
* @see Uri::withPort()
41-
*/
42-
public function setPort(int $port): UrlHelper
43-
{
44-
if ($port < 1 || $port > 65535) {
45-
throw new InvalidArgumentException('Invalid port "' . $port . '" specified, must be a valid TCP/UDP port.', 1436717326);
46-
}
47-
48-
$this->port = $port;
49-
return $this;
50-
}
51-
52-
/**
53-
* @deprecated Will be removed with v12. Use Uri::withScheme instead.
54-
* @see Uri::withScheme()
55-
*/
56-
public function setScheme(string $scheme): UrlHelper
57-
{
58-
$this->scheme = $this->sanitizeScheme($scheme);
59-
return $this;
60-
}
61-
62-
/**
63-
* @deprecated Will be removed with v12. Use withPath instead.
64-
* @see Uri::withPath()
65-
*/
66-
public function setPath(string $path): UrlHelper
67-
{
68-
if (str_contains($path, '?')) {
69-
throw new InvalidArgumentException('Invalid path provided. Must not contain a query string.', 1436717330);
70-
}
71-
72-
if (str_contains($path, '#')) {
73-
throw new InvalidArgumentException('Invalid path provided; must not contain a URI fragment', 1436717332);
74-
}
75-
$this->path = $this->sanitizePath($path);
76-
return $this;
77-
}
78-
7927
/**
8028
* Remove a given parameter from the query and create a new instance.
8129
*/
@@ -95,25 +43,6 @@ public function withoutQueryParameter(string $parameterName): UrlHelper
9543
return $clonedObject;
9644
}
9745

98-
/**
99-
* @throws InvalidArgumentException
100-
* @deprecated Will be removed with v12. Use {@link withoutQueryParameter()} instead.
101-
*/
102-
public function removeQueryParameter(string $parameterName): UrlHelper
103-
{
104-
parse_str($this->query, $parameters);
105-
if (isset($parameters[$parameterName])) {
106-
unset($parameters[$parameterName]);
107-
}
108-
$query = '';
109-
if (!empty($parameters)) {
110-
$query = http_build_query($parameters);
111-
}
112-
$this->query = $this->sanitizeQuery($query);
113-
114-
return $this;
115-
}
116-
11746
/**
11847
* Add a given parameter with value to the query and create a new instance.
11948
*/
@@ -130,32 +59,4 @@ public function withQueryParameter(string $parameterName, $value): UrlHelper
13059
$clonedObject->query = $query;
13160
return $clonedObject;
13261
}
133-
134-
/**
135-
* @throws InvalidArgumentException
136-
* @deprecated Will be removed with v12. Use {@link withQueryParameter()} instead.
137-
*/
138-
public function addQueryParameter(string $parameterName, $value): UrlHelper
139-
{
140-
$parameters = $this->query;
141-
parse_str($this->query, $parameters);
142-
if (empty($parameters)) {
143-
$parameters = [];
144-
}
145-
$parameters[$parameterName] = $value;
146-
$query = '';
147-
if (!empty($parameters)) {
148-
$query = http_build_query($parameters);
149-
}
150-
$this->query = $this->sanitizeQuery($query);
151-
return $this;
152-
}
153-
154-
/**
155-
* @deprecated Will be removed with v12. Use {@link __toString()} instead.
156-
*/
157-
public function getUrl(): string
158-
{
159-
return $this->__toString();
160-
}
16162
}

Classes/Typo3PageIndexer.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,6 @@ public function indexPage(): bool
218218
$pageDocument = $this->getPageDocument();
219219
$pageDocument = $this->substitutePageDocument($pageDocument);
220220

221-
$this->applyIndexPagePostProcessors($pageDocument);
222-
223221
self::$pageSolrDocument = $pageDocument;
224222
$documents[] = $pageDocument;
225223
$documents = $this->getAdditionalDocuments($pageDocument, $documents);
@@ -236,32 +234,6 @@ public function indexPage(): bool
236234
return $pageIndexed;
237235
}
238236

239-
/**
240-
* Applies the configured post processors (indexPagePostProcessPageDocument)
241-
*
242-
* @deprecated
243-
*/
244-
protected function applyIndexPagePostProcessors(Document $pageDocument): void
245-
{
246-
if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['Indexer']['indexPagePostProcessPageDocument'] ?? null)) {
247-
return;
248-
}
249-
250-
trigger_error(
251-
"The hook indexPagePostProcessPageDocument has been superseded by \$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['IndexQueueIndexer']['preAddModifyDocuments']",
252-
E_USER_DEPRECATED
253-
);
254-
255-
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['Indexer']['indexPagePostProcessPageDocument'] as $classReference) {
256-
$postProcessor = GeneralUtility::makeInstance($classReference);
257-
if (!$postProcessor instanceof PageDocumentPostProcessor) {
258-
throw new UnexpectedValueException(get_class($pageDocument) . ' must implement interface ' . PageDocumentPostProcessor::class, 1397739154);
259-
}
260-
261-
$postProcessor->postProcessPageDocument($pageDocument, $this->page);
262-
}
263-
}
264-
265237
/**
266238
* Builds the Solr document for the current page.
267239
*
@@ -280,9 +252,6 @@ protected function getPageDocument(): Document
280252
return $document;
281253
}
282254

283-
// Logging
284-
// TODO replace by a central logger
285-
286255
/**
287256
* Gets the mount point parameter that is used in the Frontend controller.
288257
*/

Documentation/Development/Indexing.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ Registered classes can be used to replace/substitute a Solr document of a page.
2929
Registration with: $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['Indexer']['indexPageSubstitutePageDocument']
3030
Required Interface: SubstitutePageIndexer
3131

32-
indexPagePostProcessPageDocument
33-
--------------------------------
34-
35-
This is deprecated in favor of preAddModifyDocuments.
36-
37-
Registered classes can be used to post process a Solr document of a page.
38-
39-
Registration with: $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['Indexer']['indexPagePostProcessPageDocument']
40-
Required Interface: PageDocumentPostProcessor
41-
4232

4333
preAddModifyDocuments
4434
---------------------

Tests/Integration/IndexQueue/FrontendHelper/TestPostProcessor.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

Tests/Unit/System/Url/UrlHelperTest.php

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
*/
2626
class UrlHelperTest extends SetUpUnitTestCase
2727
{
28-
/**
29-
* @return array
30-
*/
31-
public function removeQueryParameter()
28+
public function withoutQueryParameter(): array
3229
{
3330
return [
3431
'cHash at the end' => [
@@ -59,14 +56,14 @@ public function removeQueryParameter()
5956
];
6057
}
6158
/**
62-
* @dataProvider removeQueryParameter
59+
* @dataProvider withoutQueryParameter
6360
* @test
6461
*/
6562
public function testCanRemoveQueryParameter($input, $queryParameterToRemove, $expectedUrl)
6663
{
6764
$urlHelper = new UrlHelper($input);
68-
$urlHelper->removeQueryParameter($queryParameterToRemove);
69-
self::assertSame($expectedUrl, $urlHelper->getUrl(), 'Can not remove query parameter as expected');
65+
$urlHelper = $urlHelper->withoutQueryParameter($queryParameterToRemove);
66+
self::assertSame($expectedUrl, (string)$urlHelper, 'Can not remove query parameter as expected');
7067
}
7168

7269
/**
@@ -91,47 +88,7 @@ public function getUrl()
9188
public function testGetUrl($inputUrl, $expectedOutputUrl)
9289
{
9390
$urlHelper = new UrlHelper($inputUrl);
94-
self::assertSame($expectedOutputUrl, $urlHelper->getUrl(), 'Can not get expected output url');
95-
}
96-
97-
/**
98-
* @test
99-
*/
100-
public function testSetHost()
101-
{
102-
$urlHelper = new UrlHelper('http://www.google.de/test/index.php?foo=bar');
103-
$urlHelper->setHost('www.test.de');
104-
self::assertSame('http://www.test.de/test/index.php?foo=bar', $urlHelper->getUrl());
105-
}
106-
107-
/**
108-
* @test
109-
*/
110-
public function testSetHostWithPort()
111-
{
112-
$urlHelper = new UrlHelper('http://www.google.de/test/index.php?foo=bar');
113-
$urlHelper->setHost('www.test.de:8080');
114-
self::assertSame('http://www.test.de:8080/test/index.php?foo=bar', $urlHelper->getUrl());
115-
}
116-
117-
/**
118-
* @test
119-
*/
120-
public function testSetScheme()
121-
{
122-
$urlHelper = new UrlHelper('http://www.google.de/test/index.php?foo=bar');
123-
$urlHelper->setScheme('https');
124-
self::assertSame('https://www.google.de/test/index.php?foo=bar', $urlHelper->getUrl());
125-
}
126-
127-
/**
128-
* @test
129-
*/
130-
public function testSetPath()
131-
{
132-
$urlHelper = new UrlHelper('http://www.google.de/one/two?foo=bar');
133-
$urlHelper->setPath('/one/two');
134-
self::assertSame('http://www.google.de/one/two?foo=bar', $urlHelper->getUrl());
91+
self::assertSame($expectedOutputUrl, (string)$urlHelper, 'Can not get expected output url');
13592
}
13693

13794
public function unmodifiedUrl()
@@ -149,7 +106,7 @@ public function unmodifiedUrl()
149106
public function testGetUnmodifiedUrl($uri)
150107
{
151108
$urlHelper = new UrlHelper($uri);
152-
self::assertSame($uri, $urlHelper->getUrl(), 'Could not get unmodified url');
109+
self::assertSame($uri, (string)$urlHelper, 'Could not get unmodified url');
153110
}
154111

155112
/**

0 commit comments

Comments
 (0)