Issue Task New Orphaned

#105873Should always store page id in tx_linkvalidator_broken_links not pid

Sybille Peters 01/01/25, 10:32 updated 01/01/25, 10:32

Description

The tx_linkvalidator_broken_links.record_pid always contains the pid of the content record. For pages, this is inconvenient because we need the uid, not the pid. We always need the page id.

It would be better if we generally store the page id instead of the pid.

The current state requires a lot of awkward DB queries where we have to consider pages and non-pages seperately:

For example:

->where(
                    $queryBuilder->expr()->or(
                        $queryBuilder->expr()->and(
                            $queryBuilder->expr()->in(
                                'record_uid',
                                $queryBuilder->quoteArrayBasedValueListToIntegerList($pageIdsChunk)
                            ),
                            $queryBuilder->expr()->eq('table_name', $queryBuilder->quote('pages'))
                        ),
                        $queryBuilder->expr()->and(
                            $queryBuilder->expr()->in(
                                'record_pid',
                                $queryBuilder->quoteArrayBasedValueListToIntegerList($pageIdsChunk)
                            ),
                            $queryBuilder->expr()->neq('table_name', $queryBuilder->quote('pages'))
                        )
                    )

https://github.com/TYPO3/typo3/blob/83a4a08b2a47534746593ae23f0d6e870f714f53/typo3/sysext/linkvalidator/Classes/Repository/BrokenLinkRepository.php#L107C17-L123C22

 $constraints = [
                $queryBuilder->expr()->or(
                    $queryBuilder->expr()->and(
                        $queryBuilder->expr()->in(
                            'record_uid',
                            $queryBuilder->quoteArrayBasedValueListToIntegerList($pageIdsChunk)
                        ),
                        $queryBuilder->expr()->eq('table_name', $queryBuilder->quote('pages'))
                    ),
                    $queryBuilder->expr()->and(
                        $queryBuilder->expr()->in(
                            'record_pid',
                            $queryBuilder->quoteArrayBasedValueListToIntegerList($pageIdsChunk)
                        ),
                        $queryBuilder->expr()->neq('table_name', $queryBuilder->quote('pages'))
                    )
                ),

https://github.com/TYPO3/typo3/blob/83a4a08b2a47534746593ae23f0d6e870f714f53/typo3/sysext/linkvalidator/Classes/Repository/BrokenLinkRepository.php#L266C12-L282C19

etc. ….

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[TASK] Should always store page id in tx_linkvalidator_broken_links not pid Resolves: #105873 Releases: main