• 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/Utility/PageAccessUtility.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\Utility;
13

14
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
15
use TYPO3\CMS\Core\Database\Connection;
16
use TYPO3\CMS\Core\Database\ConnectionPool;
17
use TYPO3\CMS\Core\Database\Query\QueryHelper;
18
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
19
use TYPO3\CMS\Core\Type\Bitmask\Permission;
20
use TYPO3\CMS\Core\Utility\GeneralUtility;
21
use YoastSeoForTypo3\YoastSeo\Constants\TableNames;
22

23
class PageAccessUtility
24
{
25
    /** @var int[] */
26
    protected static array $cache = [];
27

28
    /**
29
     * @return int[]
30
     */
31
    public static function getPageIds(int $pid): array
32
    {
33
        if (self::$cache !== []) {
×
34
            return self::$cache;
×
35
        }
36

37
        $backendUser = self::getBackendUser();
×
38
        $perms_clause = $backendUser->getPagePermsClause(Permission::PAGE_SHOW);
×
39

40
        return self::$cache = GeneralUtility::intExplode(
×
41
            ',',
×
42
            self::getTreeList($pid, 999, 0, $perms_clause)
×
43
        );
×
44
    }
45

46
    /**
47
     * Copied from EXT:core, removed in v12
48
     */
49
    protected static function getTreeList(int $id, int $depth, int $begin = 0, string $permClause = ''): string
50
    {
51
        if ($id < 0) {
×
52
            $id = abs($id);
×
53
        }
54
        $theList = $begin === 0 ? $id : '';
×
55
        if (!($id && $depth > 0)) {
×
56
            return (string)$theList;
×
57
        }
58

NEW
59
        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(TableNames::PAGES);
×
60
        $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
×
61
        $queryBuilder->select('uid')
×
NEW
62
            ->from(TableNames::PAGES)
×
63
            ->where(
×
64
                $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, Connection::PARAM_INT)),
×
65
                $queryBuilder->expr()->eq('sys_language_uid', 0)
×
66
            )
×
67
            ->orderBy('uid');
×
68
        if ($permClause !== '') {
×
69
            $queryBuilder->andWhere(QueryHelper::stripLogicalOperatorPrefix($permClause));
×
70
        }
71
        foreach ($queryBuilder->executeQuery()->fetchAllAssociative() as $row) {
×
72
            if ($begin <= 0) {
×
73
                $theList .= ',' . $row['uid'];
×
74
            }
75
            if ($depth > 1) {
×
76
                $theSubList = self::getTreeList($row['uid'], $depth - 1, $begin - 1, $permClause);
×
77
                if (!empty($theList) && !empty($theSubList) && ($theSubList[0] !== ',')) {
×
78
                    $theList .= ',';
×
79
                }
80
                $theList .= $theSubList;
×
81
            }
82
        }
83
        return (string)$theList;
×
84
    }
85

86
    protected static function getBackendUser(): BackendUserAuthentication
87
    {
88
        return $GLOBALS['BE_USER'];
×
89
    }
90
}
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