1
|
|
|
<?php declare(strict_types = 1); |
2
|
|
|
|
3
|
|
|
namespace ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper; |
4
|
|
|
|
5
|
|
|
/*************************************************************** |
6
|
|
|
* Copyright notice |
7
|
|
|
* |
8
|
|
|
* (c) 2019 Timo Hund <[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
|
|
|
* A copy is found in the textfile GPL.txt and important notices to the license |
20
|
|
|
* from the author is found in LICENSE.txt distributed with these scripts. |
21
|
|
|
* |
22
|
|
|
* |
23
|
|
|
* This script is distributed in the hope that it will be useful, |
24
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
25
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
26
|
|
|
* GNU General Public License for more details. |
27
|
|
|
* |
28
|
|
|
* This copyright notice MUST APPEAR in all copies of the script! |
29
|
|
|
***************************************************************/ |
30
|
|
|
|
31
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper\UriBuilder\AbstractUriStrategy; |
32
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper\UriBuilder\SolrSiteStrategy; |
33
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper\UriBuilder\TYPO3SiteStrategy; |
34
|
|
|
use ApacheSolrForTypo3\Solr\System\Util\SiteUtility; |
35
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* This class is responsible to retrieve an "UriStrategy" the can build uri's for the site where the |
39
|
|
|
* passed page belongs to. |
40
|
|
|
* |
41
|
|
|
* This can be: |
42
|
|
|
* * A TYPO3 site managed with site management |
43
|
|
|
* * A TYPO3 site without site management where the url is build by EXT:solr with L and id param and information from the domain |
44
|
|
|
* record or solr specific configuration. |
45
|
|
|
* |
46
|
|
|
* @package ApacheSolrForTypo3\Solr\Domain\Index\PageIndexer\Helper |
47
|
|
|
*/ |
48
|
|
|
class UriStrategyFactory |
49
|
|
|
{ |
50
|
|
|
/** |
51
|
|
|
* @param integer $pageId |
52
|
|
|
* @oaram array $overrideConfiguration |
53
|
|
|
* @return AbstractUriStrategy |
54
|
|
|
*/ |
55
|
|
|
public function getForPageId(int $pageId): AbstractUriStrategy |
|
|
|
|
56
|
|
|
{ |
57
|
|
|
// @todo by now using the site urls leads to problems |
58
|
|
|
// since e.g. fallbacks do not work and urls could be indexed that lead to a 404 error |
59
|
|
|
// when this is resolved we could generate the urls with the router of the site for indexing with solr |
60
|
|
|
// if (SiteUtility::getIsSiteManagedSite($pageId)) { |
|
|
|
|
61
|
|
|
// return GeneralUtility::makeInstance(TYPO3SiteStrategy::class); |
|
|
|
|
62
|
|
|
// } |
63
|
|
|
|
64
|
|
|
return GeneralUtility::makeInstance(SolrSiteStrategy::class); |
65
|
|
|
} |
66
|
|
|
} |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.