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

Yoast / Yoast-SEO-for-TYPO3 / 13327579701

14 Feb 2025 10:43AM UTC coverage: 1.276%. First build
13327579701

push

github

web-flow
Merge pull request #597 from Yoast/feature/v11

[FEATURE] Release 11.0.0

21 of 894 new or added lines in 76 files covered. (2.35%)

35 of 2744 relevant lines covered (1.28%)

0.04 hits per line

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

0.0
/Classes/DataProviders/OrphanedContentDataProvider.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace YoastSeoForTypo3\YoastSeo\DataProviders;
6

7
use Doctrine\DBAL\Result;
8
use TYPO3\CMS\Core\Database\Connection;
9
use TYPO3\CMS\Core\Database\ConnectionPool;
10
use TYPO3\CMS\Core\Utility\GeneralUtility;
11
use YoastSeoForTypo3\YoastSeo\Utility\YoastUtility;
12

13
class OrphanedContentDataProvider extends AbstractOverviewDataProvider
14
{
15
    public function getKey(): string
16
    {
17
        return 'orphaned';
×
18
    }
19

20
    public function getLabel(): string
21
    {
22
        return 'LLL:EXT:yoast_seo/Resources/Private/Language/BackendModuleOverview.xlf:orphanedContent';
×
23
    }
24

25
    public function getDescription(): string
26
    {
27
        return 'LLL:EXT:yoast_seo/Resources/Private/Language/BackendModuleOverview.xlf:orphanedContent.description';
×
28
    }
29

30
    public function getLink(): ?string
31
    {
32
        return 'https://yoa.st/1ja';
×
33
    }
34

35
    /** @var int[] */
36
    protected array $referencedPages = [];
37

38
    /**
39
     * @param int[] $pageIds
40
     */
41
    public function getResults(array $pageIds = []): ?Result
42
    {
43
        if ($this->referencedPages === []) {
×
44
            $this->referencedPages = $this->getReferencedPages();
×
45
        }
46

47
        $qb = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
×
48

49
        $constraints = [
×
50
            $qb->expr()->in('doktype', YoastUtility::getAllowedDoktypes()),
×
NEW
51
            $qb->expr()->eq('sys_language_uid', $this->dataProviderRequest->getLanguage()),
×
52
        ];
×
53
        if (count($this->referencedPages) > 0) {
×
54
            $constraints[] = $qb->expr()->notIn('uid', $this->referencedPages);
×
55
        }
56
        if (count($pageIds) > 0) {
×
57
            $constraints[] = $qb->expr()->in(
×
58
                $this->dataProviderRequest->getLanguage() > 0 ? $GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField'] : 'uid',
×
59
                $pageIds
×
60
            );
×
61
        }
62

63
        return $qb->select('*')
×
64
            ->from('pages')
×
65
            ->where(...$constraints)
×
66
            ->executeQuery();
×
67
    }
68

69
    /**
70
     * @return int[]
71
     */
72
    protected function getReferencedPages(): array
73
    {
74
        $qb = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_refindex');
×
75

76
        $constraints = [
×
77
            $qb->expr()->eq('ref_table', $qb->createNamedParameter('pages')),
×
78
            $qb->expr()->notIn(
×
79
                'field',
×
80
                $qb->createNamedParameter([
×
81
                    'l10n_parent',
×
NEW
82
                    'db_mountpoints',
×
83
                ], Connection::PARAM_STR_ARRAY)
×
NEW
84
            ),
×
85
        ];
×
86

87
        $references = $qb->select('ref_uid')
×
88
            ->from('sys_refindex')
×
89
            ->where(...$constraints)
×
90
            ->groupBy('ref_uid')
×
91
            ->executeQuery()
×
92
            ->fetchAllAssociative();
×
93

94
        return array_column($references, 'ref_uid');
×
95
    }
96
}
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