• Benni Mack's avatar
    [!!!][TASK] Remove move placeholders · 27c7de8a
    Benni Mack authored and Christian Kuhn's avatar Christian Kuhn committed
    Workspaces ("Element-based versioning") previously had - due to
    the "pid=-1" logic until TYPO3 v10 - a so-called "MOVE PLACEHOLDER".
    This was indicated by t3ver_state = 3, all relevant fields:
    * t3ver_state = 3 (move placeholder)
    * t3ver_oid = 0 no connected live record, it allowed fetching these records
      with one query together with live records as db restrictions t3ver_oid > 0
    * t3ver_wsid = workspace UID
    * t3ver_move_id = UID of the live record
    * pid = new PID the version was moved to
    * sorting - when a record was moved within page with activated sorting
    Other record fields were not important. However, when moving a record, the
    value from TCA ctrl section "shadowColumnsForMovePlaceholders" was used to
    fill in gaps from the live record.
    The ACTUAL versioned record was indicated by t3ver_state = 4, the so-called
    "MOVE POINTER". In previous version until TYPO3 v10, it's PID field was set
    to -1, but since TYPO3 v10, it has the same PID as the "MOVE PLACEHOLDER".
    Characteristics of the move pointer as of TYPO3 v10:
    * t3ver_state = 4 (move pointer)
    * t3ver_oid = UID of the live record
    * t3ver_wsid = workspace UID
    * t3ver_move_id = 0
    * pid = PID the version was moved to
    * sorting - same value as the live record (not evaluated until now)
    * All other fields with optionally modified content
    Both move placeholder and move pointer did not know each other directly.
    Fetching the move pointer for a move placeheldor (or the other way around)
    involved the live record, leading to many queries.
    The patch obsoletes the move placeholder records, moving necessary
    information to the move pointer: It now contains the updated sorting
    and is considered in the Database Restrictions to be fetched.
    In general, when publishing, the moved record now
    behaves identical to the other versioned types.
    This makes the internal code much easier, creates less DB queries
    on read + write and leads to less DB records in the database.
    The change removes creation of move placeholders, and considers the
    move pointers when evaluating sorting and PID in DataHandler.
    Read functionality from BackendUtility and PageRepository don't need an
    additional step to fetch the live version of a move placeholder anymore.
    An upgrade wizard takes existing move placeholders (state=3), updates
    pid+sorting (PID generally not needed, just to be sure) of the move
    pointer (state=4) and then deletes the move placeholder.
    TCA definition $TCA[my-table][ctrl][shadowColumnsForMovePlaceholders]
    is not needed anymore and removed by an auto TCA migration.
    Finally, workspace enabled tables do not need the t3ver_move_id field
    anymore: The live record UID is already in t3ver_oid field for state=4
    records, just like with all other versioned records. The field will
    be fully removed with a separate patch in order to keep the actual CSV
    tests readable for this patch.
    Resolves: #92497
    Releases: master
    Change-Id: I206336aec8be8a324fefdfd69f648f5a298c6ad1
    Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65797
    Tested-by: default avatarTYPO3com <noreply@typo3.com>
    Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
    Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
    Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
    Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>