• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tomasnorre / crawler / 43583010903

14 Nov 2026 09:58AM UTC coverage: 67.631% (+0.1%) from 67.525%
43583010903

push

github

web-flow
!!! [TASK] Move the configuration lookup out of CrawlerController (#1334)

The new PageConfigurationResolver finds the crawler configurations of
pages, from page TSconfig and tx_crawler_configuration records. It
replaces CrawlerController::getUrlsForPageRow(), getUrlsForPageId(),
getPageTSconfigForId() and getConfigurationsForBranch(). The mount
point is a parameter instead of the CrawlerController::$MP state.

QueueService and the "Start Crawling" backend module use the resolver
directly. The getPageTSconfigForId and processUrls hooks receive the
resolver as parent object.

This lowers the cognitive complexity of CrawlerController from 74 to
54, and removes 2 entries from the Psalm baseline.

52 of 68 new or added lines in 4 files covered. (76.47%)

1 existing line in 1 file now uncovered.

1239 of 1832 relevant lines covered (67.63%)

5.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.83
/Classes/Domain/Repository/ConfigurationRepository.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace AOE\Crawler\Domain\Repository;
6

7
/*
8
 * (c) 2021 Tomas Norre Mikkelsen <tomasnorre@gmail.com>
9
 *
10
 * This file is part of the TYPO3 Crawler Extension.
11
 *
12
 * It is free software; you can redistribute it and/or modify it under
13
 * the terms of the GNU General Public License, either version 2
14
 * of the License, or any later version.
15
 *
16
 * For the full copyright and license information, please read the
17
 * LICENSE.txt file that was distributed with this source code.
18
 *
19
 * The TYPO3 project - inspiring people to share!
20
 */
21

22
use Doctrine\DBAL\ArrayParameterType;
23
use TYPO3\CMS\Backend\Utility\BackendUtility;
24
use TYPO3\CMS\Core\Database\ConnectionPool;
25
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
26
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
27
use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
28
use TYPO3\CMS\Core\Utility\GeneralUtility;
29
use TYPO3\CMS\Extbase\Persistence\Repository;
30

31
/**
32
 * @internal since v9.2.5
33
 */
34
class ConfigurationRepository extends Repository
35
{
36
    final public const TABLE_NAME = 'tx_crawler_configuration';
37

38
    /**
39
     * Traverses up the rootline of a page and fetches all crawler records.
40
     */
41
    public function getCrawlerConfigurationRecordsFromRootLine(int $pageId, array $parentIds = []): array
42
    {
43
        if (empty($parentIds)) {
13 ✔
44
            $pageIdsInRootLine = [];
13 ✔
45
            $rootLine = BackendUtility::BEgetRootLine($pageId);
13 ✔
46

47
            foreach ($rootLine as $pageInRootLine) {
13 ✔
48
                $pageIdsInRootLine[] = (int) $pageInRootLine['uid'];
12 ✔
49
            }
50
        } else {
UNCOV
51
            $pageIdsInRootLine = $parentIds;
×
52
        }
53

54
        $queryBuilder = $this->createQueryBuilder();
13 ✔
55
        $queryBuilder
13 ✔
56
            ->getRestrictions()->removeAll()
13 ✔
57
            ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
13 ✔
58
            ->add(GeneralUtility::makeInstance(HiddenRestriction::class));
13 ✔
59
        return $queryBuilder
13 ✔
60
            ->select('*')
13 ✔
61
            ->from(self::TABLE_NAME)
13 ✔
62
            ->where(
13 ✔
63
                $queryBuilder->expr()->in(
13 ✔
64
                    'pid',
13 ✔
65
                    $queryBuilder->createNamedParameter($pageIdsInRootLine, ArrayParameterType::INTEGER)
13 ✔
66
                )
13 ✔
67
            )
13 ✔
68
            ->orderBy('name')
13 ✔
69
            ->executeQuery()
13 ✔
70
            ->fetchAllAssociative();
13 ✔
71
    }
72

73
    protected function createQueryBuilder(): QueryBuilder
74
    {
75
        return GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(self::TABLE_NAME);
13 ✔
76
    }
77
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc