1 | <?php |
||
26 | * This hook is specifically used to index external files found on pages through the crawler extension. |
||
27 | * @see \TYPO3\CMS\IndexedSearch\Indexer::extractLinks() |
||
28 | * @internal this is a TYPO3-internal hook implementation and not part of TYPO3's Core API. |
||
29 | */ |
||
30 | class IndexedSearchCrawlerFilesHook |
||
31 | { |
||
32 | /** |
||
33 | * Call back function for execution of a log element |
||
34 | * |
||
35 | * @param array $params Params from log element. |
||
36 | * @return array|null Result array |
||
37 | */ |
||
38 | public function crawler_execute($params) |
||
39 | { |
||
40 | if (!is_array($params['conf'])) { |
||
41 | return null; |
||
42 | } |
||
43 | // Initialize the indexer class: |
||
44 | $indexerObj = GeneralUtility::makeInstance(\TYPO3\CMS\IndexedSearch\Indexer::class); |
||
45 | $indexerObj->conf = $params['conf']; |
||
46 | $indexerObj->init(); |
||
47 | // Index document: |
||
48 | if ($params['alturl']) { |
||
49 | $fI = pathinfo($params['document']); |
||
50 | $ext = strtolower($fI['extension']); |
||
51 | $indexerObj->indexRegularDocument($params['alturl'], true, $params['document'], $ext); |
||
52 | } else { |
||
53 | $indexerObj->indexRegularDocument($params['document'], true); |
||
54 | } |
||
55 | // Return OK: |
||
59 |