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

Yoast / Yoast-SEO-for-TYPO3 / 24723291290

21 Apr 2026 12:50PM UTC coverage: 10.457% (+9.2%) from 1.275%
24723291290

push

github

web-flow
Merge pull request #632 from Yoast/feature/yoast-v12

[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

40 of 806 new or added lines in 69 files covered. (4.96%)

40 existing lines in 23 files now uncovered.

284 of 2716 relevant lines covered (10.46%)

0.29 hits per line

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

0.0
/Classes/Widgets/Provider/OrphanedContentDataProvider.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\Widgets\Provider;
13

14
use TYPO3\CMS\Core\Database\Connection;
15
use TYPO3\CMS\Core\Database\ConnectionPool;
16
use TYPO3\CMS\Core\Type\Bitmask\Permission;
17
use TYPO3\CMS\Core\Utility\GeneralUtility;
18
use YoastSeoForTypo3\YoastSeo\Constants\TableNames;
19
use YoastSeoForTypo3\YoastSeo\Traits\BackendUserTrait;
20

21
class OrphanedContentDataProvider implements PageProviderInterface
22
{
23
    use BackendUserTrait;
24

25
    public function __construct(
26
        /** @var int[] */
27
        private array $excludedDoktypes,
28
        private int $limit
29
    ) {
30
        $this->limit = $limit ?: 5;
×
31
    }
32

33
    /**
34
     * @return array<int, array<string, mixed>>
35
     */
36
    public function getPages(): array
37
    {
NEW
38
        $qb = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(TableNames::SYS_REFINDEX);
×
39

40
        $constraints = [
×
NEW
41
            $qb->expr()->eq('ref_table', $qb->createNamedParameter(TableNames::PAGES)),
×
42
            $qb->expr()->notIn(
×
43
                'field',
×
44
                $qb->createNamedParameter([
×
45
                    'l10n_parent',
×
46
                    'db_mountpoints',
×
47
                ], Connection::PARAM_STR_ARRAY)
×
48
            ),
×
49
        ];
×
50

51
        $refs = $qb->select('ref_uid')
×
NEW
52
            ->from(TableNames::SYS_REFINDEX)
×
53
            ->where(...$constraints)
×
54
            ->groupBy('ref_uid')
×
55
            ->executeQuery()
×
56
            ->fetchAllAssociative();
×
57

58
        $pageIds = [];
×
59
        foreach ($refs as $ref) {
×
60
            $pageIds[] = $ref['ref_uid'];
×
61
        }
62

63
        $items = [];
×
64
        $counter = 0;
×
65
        $iterator = 0;
×
66

67
        $constraints = [];
×
68
        if (count($pageIds)) {
×
69
            $constraints = [
×
70
                $qb->expr()->notIn('p.doktype', $this->excludedDoktypes),
×
71
                $qb->expr()->notIn('p.uid', $pageIds),
×
72
            ];
×
73
        }
74

NEW
75
        $qb = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(TableNames::PAGES);
×
76
        while ($counter < $this->limit) {
×
77
            $row = $qb->select('p.*')
×
NEW
78
                ->from(TableNames::PAGES, 'p')
×
79
                ->where(...$constraints)
×
80
                ->orderBy('tstamp', 'DESC')
×
81
                ->setFirstResult($iterator)
×
82
                ->setMaxResults(1)
×
83
                ->executeQuery()
×
84
                ->fetchAssociative();
×
85

86
            if ($row === false) {
×
87
                // Likely fewer pages than the limit, prevent infinite loop
88
                break;
×
89
            }
90

91
            $iterator++;
×
92

93
            if (!$this->getBackendUser()->doesUserHaveAccess($row, Permission::PAGE_SHOW)) {
×
94
                continue;
×
95
            }
96

97
            $items[] = $row;
×
98
            $counter++;
×
99
        }
100

101
        return $items;
×
102
    }
103
}
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