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

Yoast / Yoast-SEO-for-TYPO3 / 21521134747

30 Jan 2026 03:30PM UTC coverage: 0.866% (-0.4%) from 1.275%
21521134747

push

github

RinyVT
[FEATURE] Version 12.0.0, added v14 support, removed v11 support including php8.0 and php8.1, rewrote backend javascript functionality to typescript and webcomponents

0 of 550 new or added lines in 53 files covered. (0.0%)

33 existing lines in 21 files now uncovered.

23 of 2657 relevant lines covered (0.87%)

0.03 hits per line

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

0.0
/Classes/Service/Crawler/CrawlerService.php
1
<?php
2

3
/**
4
 * This file is part of the "yoast_seo" extension for TYPO3 CMS.
5
 *
6
 * For the full copyright and license information, please read the
7
 * LICENSE.txt file that was distributed with this source code.
8
 */
9

10
declare(strict_types=1);
11

12
namespace YoastSeoForTypo3\YoastSeo\Service\Crawler;
13

14
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
15
use TYPO3\CMS\Core\Database\ConnectionPool;
16
use TYPO3\CMS\Core\Registry;
17
use YoastSeoForTypo3\YoastSeo\Utility\PageAccessUtility;
18
use YoastSeoForTypo3\YoastSeo\Utility\YoastUtility;
19

20
class CrawlerService
21
{
22
    protected const REGISTRY_NAMESPACE = 'tx_yoastseo';
23
    protected const REGISTRY_KEY = 'crawler-%d-%d';
24
    protected const INDEX_CHUNK = 50;
25

26
    public function __construct(
27
        protected FrontendInterface $cache,
28
        protected Registry $registry,
29
        protected ConnectionPool $connectionPool,
UNCOV
30
    ) {}
×
31

32
    public function getAmountOfPages(int $site, int $languageId): int
33
    {
34
        return count($this->getPagesToIndex($site, $languageId));
×
35
    }
36

37
    /**
38
     * @return array{pages: array<int>, current: int, nextOffset: int, total: int}
39
     */
40
    public function getIndexInformation(int $site, int $languageId, int $offset = 0): array
41
    {
42
        $pagesToIndex = $this->getPagesToIndex($site, $languageId);
×
43
        $total = count($pagesToIndex);
×
44

45
        $progressInformation = $this->getProgressInformation($site, $languageId);
×
46
        $currentOffset = $offset > 0 ? $offset : ($progressInformation['offset'] ?? 0);
×
47
        $this->setProgressInformation($site, $languageId, $currentOffset, $total);
×
48

49
        return [
×
50
            'pages' => array_splice($pagesToIndex, $currentOffset, self::INDEX_CHUNK),
×
51
            'current' => $currentOffset,
×
52
            'nextOffset' => $currentOffset + self::INDEX_CHUNK,
×
53
            'total' => $total,
×
54
        ];
×
55
    }
56

57
    /**
58
     * @return array{offset?: int, total?: int}
59
     */
60
    public function getProgressInformation(int $site, int $languageId): array
61
    {
62
        return (array)$this->registry->get(
×
63
            self::REGISTRY_NAMESPACE,
×
64
            sprintf(self::REGISTRY_KEY, $site, $languageId),
×
65
            []
×
66
        );
×
67
    }
68

69
    protected function setProgressInformation(int $site, int $languageId, int $offset, int $total): void
70
    {
71
        $this->registry->set(
×
72
            self::REGISTRY_NAMESPACE,
×
73
            sprintf(self::REGISTRY_KEY, $site, $languageId),
×
74
            [
×
75
                'offset' => $offset,
×
76
                'total' => $total,
×
77
            ]
×
78
        );
×
79
    }
80

81
    public function resetProgressInformation(int $site, int $languageId): void
82
    {
83
        $this->registry->remove(self::REGISTRY_NAMESPACE, sprintf(self::REGISTRY_KEY, $site, $languageId));
×
84
    }
85

86
    /**
87
     * @return int[]
88
     */
89
    protected function getPagesToIndex(int $site, int $languageId): array
90
    {
91
        $cacheIdentifier = 'YoastSeoCrawler' . $site . '-' . $languageId;
×
92
        if (($pagesToIndex = $this->cache->get($cacheIdentifier)) === false) {
×
93
            $treeList = PageAccessUtility::getPageIds($site);
×
94
            $pagesToIndex = [];
×
95
            foreach (array_chunk($treeList, 1000) as $treeChunk) {
×
NEW
96
                $queryBuilder = $this->connectionPool->getQueryBuilderForTable('pages');
×
97

98
                if ($languageId > 0) {
×
99
                    $select = 'l10n_parent';
×
100
                    $constraints = [
×
101
                        $queryBuilder->expr()->eq('sys_language_uid', $languageId),
×
102
                        $queryBuilder->expr()->in(
×
103
                            'l10n_parent',
×
104
                            $treeChunk
×
105
                        ),
×
106
                    ];
×
107
                } else {
108
                    $select = 'uid';
×
109
                    $constraints = [
×
110
                        $queryBuilder->expr()->in(
×
111
                            'uid',
×
112
                            $treeChunk
×
113
                        ),
×
114
                    ];
×
115
                }
116

117
                $pages = $queryBuilder->select($select)
×
118
                    ->from('pages')
×
119
                    ->where(
×
120
                        $queryBuilder->expr()->in(
×
121
                            'doktype',
×
122
                            YoastUtility::getAllowedDoktypes()
×
123
                        ),
×
124
                        ...$constraints
×
125
                    )->executeQuery()->fetchAllAssociative();
×
126
                $pagesToIndex = array_merge($pagesToIndex, array_column($pages, $select));
×
127
            }
128
        }
129
        return $pagesToIndex;
×
130
    }
131
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc