#111416Find the subpages of a page with one query when copying and deleting pages
Description
The DataHandler and two cleanup commands still walk the page tree with one query per page:
- DataHandler::int_pageTreeInfo() collects the subpages to copy along with a page (and to fix unique slugs after moving a page), plus a PlainDataResolver run and one getRecord() per page in a workspace
- DataHandler::getSubPagesOfPage() collects the subpages to delete or discard along with a page, including pages new in any workspace
- the commands “cleanup:deletedrecords” and “cleanup:versions” walk the whole page tree including deleted pages and the versions of all workspaces, and recurse endlessly if versions reference each other
The DataHandler fetches the subpages with the PageDescendantsRepository (#111406) instead, with one query, keeping the order the pages are copied and deleted in. Pages new in a workspace below the page to delete are found with the page tree constraint of #111412.
The commands fetch all pages with one query and walk the page tree in PHP, visiting each page once.
Measured with 780 pages: copying needs 1 instead of 781 queries to collect the subpages (2185 in a workspace), deleting 2 instead of 781. The cleanup commands save one to three queries per page (18522 to 12671 and 9546 to 5431 queries).
Reviews 1
History 03
-
Gerrit Code Review pushed patch set 1 for main to change 97560 status
NewUnder Review <span data-processor="relativetime" data-value="2026-11-11T17:31:00+00:00" > 11/11/26, 17:31 </span> -
Gerrit Code Review pushed patch set 2 for main to change 97560 <span data-processor="relativetime" data-value="2026-11-15T08:27:55+00:00" > 11/15/26, 08:27 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 97560 <span data-processor="relativetime" data-value="2026-11-19T08:45:14+00:00" > 11/19/26, 08:45 </span>