Review main Work in progress

97616[BUGFIX] Count references and translations per pid in the backend

Benni Mack CR 0 V 0 Hard +437 −86 updated 11/13/26, 14:46

Commit message

The delete confirmation of every record in the page module, the
list module, the edit form and the context menus states how many
references and translations the record has. Both numbers were
fetched with one query per record, which makes rendering a page
with many content elements slow, as the message is prepared
eagerly for each of them.

A new ReferenceCounter follows the approach of the
GreedyDatabaseBackend: asking for one record counts the references
or translations of all records on its pid in one query, and keeps
the result in the runtime cache. References to files are grouped by
their folder instead, as all files share pid 0. Tables only allowed
on the root level, or stored on another connection than the
reference index, are still counted per record.

The service replaces BackendUtility::referenceCount(),
ReferenceIndex::getNumberOfReferencedRecords() and the counting
of LocalizationRepository::getRecordTranslations() in all core
places showing these numbers. References of file metadata to its
file are now consistently left out of the count.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 1
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/16/97616/1 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/16/97616/1 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote

Merge conflicts 30

Issues 1

Files 9

Review log 1

  1. Benni Mack uploaded patch set 1 11/13/26, 14:46