Review 13.4 Merged

88370[TASK] Refactor DataHandler->moveRecord_raw()

Christian Kuhn CR +2 V +2 Hard +430 −352 updated 02/26/25, 18:26

Commit message

After juggling moveRecord() and moveRecord_raw() for three days,
the code is better tamed, more easy to follow and grasp, with
fewer lines of code.

* moveRecord_raw() becomes obsolete by integrating it into
  moveRecord().
* getRecordProperties() finally bites the dust.
* moveRecord_procBasedOnFieldType() is merged into
  moveRecord_procFields().
* resolvePid() is simplified and will most likely become
  unused soon.
* history "logging" data is improved: The existing solution did
  not write good "oldData". Rollback of moved record still does
  not work, but that is a second issue in HistoryController, not
  in DataHandler.

Removed methods that are still public in v13 will remain in the
v13 backport, but moved to the end of the class and marked unused.

The patch makes moveRecord() lengthy, but it splits into sections
that take care of preparation, fact gathering, data preparation,
permission checking and finally main move handling. The code is
not yet in a truly "clean" state, there is still room for further
improvements. Further iterations should be more easy to review.

The change saves a few queries again. To get an idea of the current
state, I measured query count of functional test
DataScenarios/Regular/{Modify|WorkspacesModify}/ActionTest.php
"movePageToDifferentPageTwice". "Before checkpoint" is git commit
eb7776ab2b35ebb49efe2088c17709b500522880, a commit before the
current series of DataHandler improvements.

Before: Modify: 739; WorkspacesModify 1555
With patch: Modify 469; WorkspacesModify 934

The absolute numbers don't say much (and mysql probably counts
each "true" query twice due to sql preparation, unsure).
But we can see these patches not only make more DataHandler
code maintainable, but also improve performance. For move, we
shaved off about 1/3 of queries already, other operations
got some share as well. There is potential for much more.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
  • Verified V +2 Done
    • Christian Kuhn +2
    • core-ci +1 CI

Issues 4

Files 1

Review log 45

  1. Christian Kuhn uploaded patch set 1 02/26/25, 18:19

  2. core-ci voted on patch set 1 V +1 02/26/25, 18:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/74784

  3. Christian Kuhn commented on patch set 1 02/26/25, 18:26

    DataHandler.php:4356

    note i can do the string hint on $table in the signature since $this->tcaSchemaFactory->has($table) has a type hint to string already, so that would fail, so i can "pull that up".
  4. Christian Kuhn voted on patch set 1 CR +2 V +2 02/26/25, 18:26

  5. Christian Kuhn merged patch set 2 02/26/25, 18:26