[CLEANUP] Use Permission constants consistently
[Packages/TYPO3.CMS.git] / typo3 / sysext / indexed_search / Classes / Domain / Repository / AdministrationRepository.php
1 <?php
2 namespace TYPO3\CMS\IndexedSearch\Domain\Repository;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16 use TYPO3\CMS\Backend\FrontendBackendUserAuthentication;
17 use TYPO3\CMS\Backend\Tree\View\PageTreeView;
18 use TYPO3\CMS\Backend\Utility\BackendUtility;
19 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
20 use TYPO3\CMS\Core\Cache\CacheManager;
21 use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
22 use TYPO3\CMS\Core\Database\Connection;
23 use TYPO3\CMS\Core\Database\ConnectionPool;
24 use TYPO3\CMS\Core\Database\Query\QueryHelper;
25 use TYPO3\CMS\Core\DataHandling\DataHandler;
26 use TYPO3\CMS\Core\Imaging\Icon;
27 use TYPO3\CMS\Core\Imaging\IconFactory;
28 use TYPO3\CMS\Core\Type\Bitmask\Permission;
29 use TYPO3\CMS\Core\Utility\GeneralUtility;
30 use TYPO3\CMS\IndexedSearch\FileContentParser;
31
32 /**
33 * Administration repository
34 */
35 class AdministrationRepository
36 {
37 /**
38 * List of fileContentParsers
39 *
40 * @var FileContentParser[]
41 */
42 public $external_parsers = [];
43
44 /**
45 * @var array
46 */
47 protected $allPhashListed = [];
48
49 /**
50 * @var array
51 */
52 protected $iconFileNameCache = [];
53
54 /**
55 * Get group list information
56 *
57 * @param int $phash
58 * @return array
59 */
60 public function getGrlistRecord($phash)
61 {
62 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_grlist');
63 $result = $queryBuilder
64 ->select('*')
65 ->from('index_grlist')
66 ->where(
67 $queryBuilder->expr()->eq(
68 'phash',
69 $queryBuilder->createNamedParameter($phash, \PDO::PARAM_INT)
70 )
71 )
72 ->execute();
73 $numberOfRows = $result->rowCount();
74 $allRows = [];
75 while ($row = $result->fetch()) {
76 $row['pcount'] = $numberOfRows;
77 $allRows[] = $row;
78 }
79 return $allRows;
80 }
81
82 /**
83 * Get number of fulltext records
84 *
85 * @param int $phash
86 * @return int|bool
87 */
88 public function getNumberOfFulltextRecords($phash)
89 {
90 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_fulltext');
91 return $queryBuilder
92 ->count('phash')
93 ->from('index_fulltext')
94 ->where(
95 $queryBuilder->expr()->eq(
96 'phash',
97 $queryBuilder->createNamedParameter($phash, \PDO::PARAM_INT)
98 )
99 )
100 ->execute()
101 ->fetchColumn(0);
102 }
103
104 /**
105 * Get number of words
106 *
107 * @param int $phash
108 * @return int|bool
109 */
110 public function getNumberOfWords($phash)
111 {
112 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_rel');
113 return $queryBuilder
114 ->count('*')
115 ->from('index_rel')
116 ->where(
117 $queryBuilder->expr()->eq(
118 'phash',
119 $queryBuilder->createNamedParameter($phash, \PDO::PARAM_INT)
120 )
121 )
122 ->execute()
123 ->fetchColumn(0);
124 }
125
126 /**
127 * Get statistic of external documents
128 *
129 * @return array
130 */
131 public function getExternalDocumentsStatistic()
132 {
133 $result = [];
134
135 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_phash');
136 $res = $queryBuilder
137 ->select('index_phash.*')
138 ->addSelectLiteral($queryBuilder->expr()->count('*', 'pcount'))
139 ->from('index_phash')
140 ->where($queryBuilder->expr()->neq('item_type', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)))
141 ->groupBy(
142 'phash_grouping',
143 'phash',
144 'cHashParams',
145 'data_filename',
146 'data_page_id',
147 'data_page_reg1',
148 'data_page_type',
149 'data_page_mp',
150 'gr_list',
151 'item_type',
152 'item_title',
153 'item_description',
154 'item_mtime',
155 'tstamp',
156 'item_size',
157 'contentHash',
158 'crdate',
159 'parsetime',
160 'sys_language_uid',
161 'item_crdate',
162 'externalUrl',
163 'recordUid',
164 'freeIndexUid',
165 'freeIndexSetId'
166 )
167 ->orderBy('item_type')
168 ->execute();
169
170 while ($row = $res->fetch()) {
171 $this->addAdditionalInformation($row);
172
173 $result[] = $row;
174
175 if ($row['pcount'] > 1) {
176 $res2 = $queryBuilder
177 ->select('*')
178 ->from('index_phash')
179 ->where(
180 $queryBuilder->expr()->eq(
181 'phash_grouping',
182 $queryBuilder->createNamedParameter($row['phash_grouping'], \PDO::PARAM_INT)
183 ),
184 $queryBuilder->expr()->neq(
185 'phash',
186 $queryBuilder->createNamedParameter($row['phash'], \PDO::PARAM_INT)
187 )
188 )
189 ->execute();
190 while ($row2 = $res2->fetch()) {
191 $this->addAdditionalInformation($row2);
192 $result[] = $row2;
193 }
194 }
195 }
196 return $result;
197 }
198
199 /**
200 * Get count of the tables used for indexed_search
201 *
202 * @return array
203 */
204 public function getRecordsNumbers()
205 {
206 $tables = [
207 'index_phash',
208 'index_words',
209 'index_rel',
210 'index_grlist',
211 'index_section',
212 'index_fulltext',
213 ];
214 $recordList = [];
215 foreach ($tables as $tableName) {
216 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($tableName);
217 $recordList[$tableName] = $queryBuilder
218 ->count('*')
219 ->from($tableName)
220 ->execute()
221 ->fetchColumn(0);
222 }
223 return $recordList;
224 }
225
226 /**
227 * Get hash types
228 *
229 * @return array
230 */
231 public function getPageHashTypes()
232 {
233 $counts = [];
234 $types = [
235 'html' => 1,
236 'htm' => 1,
237 'pdf' => 2,
238 'doc' => 3,
239 'txt' => 4
240 ];
241 $revTypes = array_flip($types);
242 $revTypes[0] = 'TYPO3 page';
243
244 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_phash');
245 $res = $queryBuilder
246 ->select('item_type')
247 ->addSelectLiteral($queryBuilder->expr()->count('*', 'count'))
248 ->from('index_phash')
249 ->groupBy('item_type')
250 ->orderBy('item_type')
251 ->execute();
252
253 while ($row = $res->fetch()) {
254 $itemType = $row['item_type'];
255 $counts[] = [
256 'count' => $row['count'],
257 'name' => $revTypes[$itemType],
258 'type' => $itemType,
259 'uniqueCount' => $this->countUniqueTypes($itemType),
260 ];
261 }
262 return $counts;
263 }
264
265 /**
266 * Count unique types
267 *
268 * @param string $itemType
269 * @return int
270 */
271 protected function countUniqueTypes($itemType)
272 {
273 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_phash');
274 $items = $queryBuilder
275 ->count('*')
276 ->from('index_phash')
277 ->where(
278 $queryBuilder->expr()->eq(
279 'item_type',
280 $queryBuilder->createNamedParameter($itemType, \PDO::PARAM_STR)
281 )
282 )
283 ->groupBy('phash_grouping')
284 ->execute()
285 ->fetchAll();
286
287 return count($items);
288 }
289
290 /**
291 * Get number of section records
292 *
293 * @param int $pageHash
294 * @return int
295 */
296 public function getNumberOfSections($pageHash)
297 {
298 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_section');
299 return (int)$queryBuilder
300 ->count('phash')
301 ->from('index_section')
302 ->where(
303 $queryBuilder->expr()->eq(
304 'phash',
305 $queryBuilder->createNamedParameter($pageHash, \PDO::PARAM_INT)
306 )
307 )
308 ->execute()
309 ->fetchColumn(0);
310 }
311
312 /**
313 * Get page statistic
314 *
315 * @return array
316 */
317 public function getPageStatistic()
318 {
319 $result = [];
320 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_phash');
321 $res = $queryBuilder
322 ->select('index_phash.*')
323 ->addSelectLiteral($queryBuilder->expr()->count('*', 'pcount'))
324 ->from('index_phash')
325 ->where($queryBuilder->expr()->neq('data_page_id', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)))
326 ->groupBy(
327 'phash_grouping',
328 'phash',
329 'cHashParams',
330 'data_filename',
331 'data_page_id',
332 'data_page_reg1',
333 'data_page_type',
334 'data_page_mp',
335 'gr_list',
336 'item_type',
337 'item_title',
338 'item_description',
339 'item_mtime',
340 'tstamp',
341 'item_size',
342 'contentHash',
343 'crdate',
344 'parsetime',
345 'sys_language_uid',
346 'item_crdate',
347 'externalUrl',
348 'recordUid',
349 'freeIndexUid',
350 'freeIndexSetId'
351 )
352 ->orderBy('data_page_id')
353 ->execute();
354
355 while ($row = $res->fetch()) {
356 $this->addAdditionalInformation($row);
357 $result[] = $row;
358
359 if ($row['pcount'] > 1) {
360 $res2 = $queryBuilder
361 ->select('*')
362 ->from('index_phash')
363 ->where(
364 $queryBuilder->expr()->eq(
365 'phash_grouping',
366 $queryBuilder->createNamedParameter($row['phash_grouping'], \PDO::PARAM_INT)
367 ),
368 $queryBuilder->expr()->neq(
369 'phash',
370 $queryBuilder->createNamedParameter($row['phash'], \PDO::PARAM_INT)
371 )
372 )
373 ->execute();
374 while ($row2 = $res2->fetch()) {
375 $this->addAdditionalInformation($row2);
376 $result[] = $row2;
377 }
378 }
379 }
380 return $result;
381 }
382
383 /**
384 * Get general statistic
385 *
386 * @param string $additionalWhere
387 * @param int $pageUid
388 * @param int $max
389 * @return array|null
390 */
391 public function getGeneralSearchStatistic($additionalWhere, $pageUid, $max = 50)
392 {
393 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
394 ->getQueryBuilderForTable('index_stat_word');
395 $queryBuilder
396 ->select('word')
397 ->from('index_stat_word')
398 ->addSelectLiteral($queryBuilder->expr()->count('*', 'c'))
399 ->where(
400 $queryBuilder->expr()->eq(
401 'pageid',
402 $queryBuilder->createNamedParameter($pageUid, \PDO::PARAM_INT)
403 )
404 )
405 ->groupBy('word')
406 ->setMaxResults((int)$max);
407
408 if (!empty($additionalWhere)) {
409 $queryBuilder->andWhere(QueryHelper::stripLogicalOperatorPrefix($additionalWhere));
410 }
411
412 $result = $queryBuilder->execute();
413 $count = (int)$result->rowCount();
414 $result->closeCursor();
415
416 // exist several statistics for this page?
417 if ($count === 0) {
418 // Limit access to pages of the current site
419 $queryBuilder->where(
420 $queryBuilder->expr()->in(
421 'pageid',
422 $queryBuilder->createNamedParameter(
423 GeneralUtility::intExplode(',', $this->extGetTreeList((int)$pageUid, 100, 0, '1=1'), true),
424 Connection::PARAM_INT_ARRAY
425 )
426 ),
427 QueryHelper::stripLogicalOperatorPrefix($additionalWhere)
428 );
429 }
430
431 return $queryBuilder->execute()->fetchAll();
432 }
433
434 /**
435 * Add additional information to the result row
436 *
437 * @param array $row
438 */
439 protected function addAdditionalInformation(array &$row)
440 {
441 $grListRec = $this->getGrlistRecord($row['phash']);
442 $unserializedCHashParams = unserialize($row['cHashParams']);
443
444 $row['numberOfWords'] = $this->getNumberOfWords($row['phash']);
445 $row['numberOfSections'] = $this->getNumberOfSections($row['phash']);
446 $row['numberOfFulltext'] = $this->getNumberOfFulltextRecords($row['phash']);
447 $row['cHashParams'] = !empty($unserializedCHashParams) ? $unserializedCHashParams : '';
448 $row['grList'] = $grListRec;
449 }
450
451 /**
452 * Get the page tree by using \TYPO3\CMS\Backend\Tree\View\PageTreeView
453 *
454 * @param int $pageId
455 * @param int $depth
456 * @param string $mode
457 * @return array
458 */
459 public function getTree($pageId, $depth = 4, $mode)
460 {
461 $allLines = [];
462 $pageRecord = BackendUtility::getRecord('pages', (int)$pageId);
463 if (!$pageRecord) {
464 return $allLines;
465 }
466 /** @var PageTreeView $tree */
467 $tree = GeneralUtility::makeInstance(PageTreeView::class);
468 $perms_clause = $this->getBackendUserAuthentication()->getPagePermsClause(Permission::PAGE_SHOW);
469 $tree->init('AND ' . $perms_clause);
470 $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
471 $HTML = '<span title="' . htmlspecialchars($pageRecord['title']) . '">' . $iconFactory->getIconForRecord('pages', $pageRecord, Icon::SIZE_SMALL)->render() . '</span>';
472 $tree->tree[] = [
473 'row' => $pageRecord,
474 'HTML' => $HTML
475 ];
476
477 if ($depth > 0) {
478 $tree->getTree((int)$pageId, $depth, '');
479 }
480
481 foreach ($tree->tree as $singleLine) {
482 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_phash');
483 $result = $queryBuilder->select(
484 'ISEC.phash_t3',
485 'ISEC.rl0',
486 'ISEC.rl1',
487 'ISEC.rl2',
488 'ISEC.page_id',
489 'ISEC.uniqid',
490 'IP.phash',
491 'IP.phash_grouping',
492 'IP.cHashParams',
493 'IP.data_filename',
494 'IP.data_page_id',
495 'IP.data_page_reg1',
496 'IP.data_page_type',
497 'IP.data_page_mp',
498 'IP.gr_list',
499 'IP.item_type',
500 'IP.item_title',
501 'IP.item_description',
502 'IP.item_mtime',
503 'IP.tstamp',
504 'IP.item_size',
505 'IP.contentHash',
506 'IP.crdate',
507 'IP.parsetime',
508 'IP.sys_language_uid',
509 'IP.item_crdate',
510 'IP.externalUrl',
511 'IP.recordUid',
512 'IP.freeIndexUid',
513 'IP.freeIndexSetId'
514 )
515 ->addSelectLiteral($queryBuilder->expr()->count('*', 'count_val'))
516 ->from('index_phash', 'IP')
517 ->from('index_section', 'ISEC')
518 ->where(
519 $queryBuilder->expr()->eq('IP.phash', $queryBuilder->quoteIdentifier('ISEC.phash')),
520 $queryBuilder->expr()->eq(
521 'ISEC.page_id',
522 $queryBuilder->createNamedParameter($singleLine['row']['uid'], \PDO::PARAM_INT)
523 )
524 )
525 ->groupBy(
526 'IP.phash',
527 'IP.phash_grouping',
528 'IP.cHashParams',
529 'IP.data_filename',
530 'IP.data_page_id',
531 'IP.data_page_reg1',
532 'IP.data_page_type',
533 'IP.data_page_mp',
534 'IP.gr_list',
535 'IP.item_type',
536 'IP.item_title',
537 'IP.item_description',
538 'IP.item_mtime',
539 'IP.tstamp',
540 'IP.item_size',
541 'IP.contentHash',
542 'IP.crdate',
543 'IP.parsetime',
544 'IP.sys_language_uid',
545 'IP.item_crdate',
546 'ISEC.phash',
547 'ISEC.phash_t3',
548 'ISEC.rl0',
549 'ISEC.rl1',
550 'ISEC.rl2',
551 'ISEC.page_id',
552 'ISEC.uniqid',
553 'IP.externalUrl',
554 'IP.recordUid',
555 'IP.freeIndexUid',
556 'IP.freeIndexSetId'
557 )
558 ->orderBy('IP.item_type')
559 ->addOrderBy('IP.tstamp')
560 ->setMaxResults(11)
561 ->execute();
562
563 $lines = [];
564 // Collecting phash values (to remove local indexing for)
565 // Traverse the result set of phash rows selected:
566 while ($row = $result->fetch()) {
567 $row['icon'] = $this->makeItemTypeIcon($row['item_type']);
568 $this->allPhashListed[] = $row['phash'];
569
570 // Adds a display row:
571 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
572 ->getQueryBuilderForTable('index_rel');
573 $wordCountResult = $queryBuilder->count('index_words.baseword')
574 ->from('index_rel')
575 ->from('index_words')
576 ->where(
577 $queryBuilder->expr()->eq(
578 'index_rel.phash',
579 $queryBuilder->createNamedParameter($row['phash'], \PDO::PARAM_INT)
580 ),
581 $queryBuilder->expr()->eq('index_words.wid', $queryBuilder->quoteIdentifier('index_rel.wid'))
582 )
583 ->groupBy('index_words.baseword')
584 ->execute();
585
586 $row['wordCount'] = $wordCountResult->rowCount();
587 $wordCountResult->closeCursor();
588
589 if ($mode === 'content') {
590 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
591 ->getQueryBuilderForTable('index_fulltext');
592 $row['fulltextData'] = $queryBuilder->select('*')
593 ->from('index_fulltext')
594 ->where(
595 $queryBuilder->expr()->eq(
596 'phash',
597 $queryBuilder->createNamedParameter($row['phash'], \PDO::PARAM_INT)
598 )
599 )
600 ->setMaxResults(1)
601 ->execute()
602 ->fetch();
603
604 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
605 ->getQueryBuilderForTable('index_rel');
606 $wordRecords = $queryBuilder->select('index_words.baseword')
607 ->from('index_rel')
608 ->from('index_words')
609 ->where(
610 $queryBuilder->expr()->eq(
611 'index_rel.phash',
612 $queryBuilder->createNamedParameter($row['phash'], \PDO::PARAM_INT)
613 ),
614 $queryBuilder->expr()->eq(
615 'index_words.wid',
616 $queryBuilder->quoteIdentifier('index_rel.wid')
617 )
618 )
619 ->groupBy('index_words.baseword')
620 ->orderBy('index_words.baseword')
621 ->execute()
622 ->fetchAll();
623
624 if (is_array($wordRecords)) {
625 $row['allWords'] = array_column($wordRecords, 'baseword');
626 }
627 }
628
629 $lines[] = $row;
630 }
631
632 $singleLine['lines'] = $lines;
633 $allLines[] = $singleLine;
634 }
635
636 return $allLines;
637 }
638
639 /**
640 * Generates a list of Page-uid's from $id.
641 * The only pages excluded from the list are deleted pages.
642 *
643 * @param int $id page id
644 * @param int $depth to traverse down the page tree.
645 * @param int $begin is an optional integer that determines at which level in the tree to start collecting uid's. Zero means 'start right away', 1 = 'next level and out'
646 * @param string $perms_clause
647 * @return string Returns the list with a comma in the end + id itself
648 */
649 protected function extGetTreeList($id, $depth, $begin = 0, $perms_clause)
650 {
651 $list = GeneralUtility::makeInstance(FrontendBackendUserAuthentication::class)
652 ->extGetTreeList($id, $depth, $begin, $perms_clause);
653
654 if (empty($list)) {
655 $list = $id;
656 } else {
657 $list = rtrim($list, ',') . ',' . $id;
658 }
659
660 return $list;
661 }
662
663 /**
664 * Remove indexed phash row
665 *
666 * @param string $phashList
667 * @param int $pageId
668 * @param int $depth
669 */
670 public function removeIndexedPhashRow($phashList, $pageId, $depth = 4)
671 {
672 if ($phashList === 'ALL') {
673 $this->getTree($pageId, $depth, '');
674 $phashRows = $this->allPhashListed;
675 $this->allPhashListed = [];
676 } else {
677 $phashRows = GeneralUtility::trimExplode(',', $phashList, true);
678 }
679
680 foreach ($phashRows as $phash) {
681 $phash = (int)$phash;
682 if ($phash > 0) {
683 $idList = [];
684 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
685 ->getQueryBuilderForTable('index_section');
686 $res = $queryBuilder
687 ->select('page_id')
688 ->from('index_section')
689 ->where(
690 $queryBuilder->expr()->eq(
691 'phash',
692 $queryBuilder->createNamedParameter($phash, \PDO::PARAM_INT)
693 )
694 )
695 ->execute();
696 while ($row = $res->fetch()) {
697 $idList[] = (int)$row['page_id'];
698 }
699
700 if (!empty($idList)) {
701 /** @var FrontendInterface $pageCache */
702 $pageCache = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_pages');
703 foreach ($idList as $pageId) {
704 $pageCache->flushByTag('pageId_' . $pageId);
705 }
706 }
707
708 // Removing old registrations for all tables.
709 $tableArr = [
710 'index_phash',
711 'index_rel',
712 'index_section',
713 'index_grlist',
714 'index_fulltext',
715 'index_debug'
716 ];
717 foreach ($tableArr as $table) {
718 GeneralUtility::makeInstance(ConnectionPool::class)
719 ->getConnectionForTable($table)
720 ->delete($table, ['phash' => (int)$phash]);
721 }
722 }
723 }
724 }
725
726 /**
727 * Save stop words
728 *
729 * @param array $words stop words
730 */
731 public function saveStopWords(array $words)
732 {
733 foreach ($words as $wid => $state) {
734 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('index_words');
735 $queryBuilder
736 ->update('index_words')
737 ->set('is_stopword', (int)$state)
738 ->where(
739 $queryBuilder->expr()->eq(
740 'wid',
741 $queryBuilder->createNamedParameter($wid, \PDO::PARAM_INT)
742 )
743 )
744 ->execute();
745 }
746 }
747
748 /**
749 * Save keywords
750 *
751 * @param array $words keywords
752 * @param int $pageId page id
753 */
754 public function saveKeywords(array $words, $pageId)
755 {
756 // Get pages current keywords
757 $pageRec = BackendUtility::getRecord('pages', $pageId);
758 if (!is_array($pageRec)) {
759 return;
760 }
761 $keywords = array_flip(GeneralUtility::trimExplode(',', $pageRec['keywords'], true));
762 // Merge keywords:
763 foreach ($words as $key => $v) {
764 if ($v) {
765 $keywords[$key] = 1;
766 } else {
767 unset($keywords[$key]);
768 }
769 }
770 // Compile new list:
771 $data = [];
772 $data['pages'][$pageId]['keywords'] = implode(', ', array_keys($keywords));
773 $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
774 $dataHandler->start($data, []);
775 $dataHandler->process_datamap();
776 }
777
778 /**
779 * Collect the type icons
780 *
781 * @param string $itemType
782 * @return string
783 */
784 protected function makeItemTypeIcon($itemType)
785 {
786 if (!isset($this->iconFileNameCache[$itemType])) {
787 $icon = '';
788 if ($itemType === '0') {
789 $icon = 'EXT:indexed_search/Resources/Public/Icons/FileTypes/pages.gif';
790 } elseif ($this->external_parsers[$itemType]) {
791 $icon = $this->external_parsers[$itemType]->getIcon($itemType);
792 }
793 $this->iconFileNameCache[$itemType] = $icon;
794 }
795 return $this->iconFileNameCache[$itemType];
796 }
797
798 /**
799 * @return BackendUserAuthentication
800 */
801 protected function getBackendUserAuthentication()
802 {
803 return $GLOBALS['BE_USER'];
804 }
805 }