Review main Merged

61641[BUGFIX] Do not check for pid=-1 when evaluating workspace records

Benni Mack CR +2 V +2 Hard +146 −115 updated 09/11/19, 12:44

Commit message

TYPO3 Core handles the result of database queries in a lot of different
ways to filter out workspace records.

With "versioning support v1" (= without workspaces), the identifier was
usually "pid = -1" to filter out records that should not be displayed in
live results.

With workspaces, there are other, better ways to identify versioned via
the following fields:
- t3ver_state (what kind of versioned record is there)
- t3ver_oid (if the versioned record points to a live record)
- t3ver_wsid (the workspace ID)

The "pid" field was kept as misuse, but fine for most of the database
queries. Since we now have Doctrine DBAL, and Restrictions, the Core
API can now be unified to actually check for "t3ver_oid>0" instead of
"pid<>-1" to identify a versioned record.

All places in TYPO3 Core now does not check for "pid<>-1" anymore for
tables that are workspace-aware.

In the future, it is then possible to get rid of the "pid=-1" value when
writing versioned records, streamlining the API effectively, to find one
proper way to query and write records.

This change does not modify any other places in TYPO3 Core where
Workspace Records are written, but only cleans up the API to only
consider "t3ver_oid" instead of "pid", avoiding the mis-use of "pid".

Most queries can then be handled by simply checking:
- t3ver_wsid=0 AND deleted=0 for only fetching live records
- t3ver_wsid IN (0,12) AND t3ver_oid=0 to find all live records,
  and draft placeholders, to do overlays then

Review

  • Code review CR +2 Done
    • Susi Moog +2
    • Oliver Hader +1
  • Verified V +2 Done
    • Susi Moog +2
    • Oliver Hader +1
    • TYPO3com +1 CI

Issues 1

Files 27

Show 7 more files

Review log 2233

Show 48 earlier messages
  1. Benni Mack uploaded patch set 1 09/08/19, 13:35

  2. TYPO3com voted on patch set 1 V -1 09/08/19, 13:44 Completed build in 08m 31s on Sun, 8 Sep, 01:44 PM Test Summary: 93 of 47741 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36187

  3. Benni Mack uploaded patch set 2 09/09/19, 14:53

  4. TYPO3com voted on patch set 2 V -1 09/09/19, 14:54 Completed build in 22s on Mon, 9 Sep, 02:54 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36221

  5. TYPO3com commented on patch set 2 09/09/19, 15:34 Completed build in 40m 24s on Mon, 9 Sep, 03:33 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36221

  6. Benni Mack uploaded patch set 3 09/09/19, 15:35

  7. TYPO3com voted on patch set 3 V +1 09/09/19, 15:46 Completed build in 10m 45s on Mon, 9 Sep, 03:46 PM Test Summary: 47382 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36225

  8. Benni Mack uploaded patch set 4 09/10/19, 05:39

  1. TYPO3com voted on patch set 4 V +1 09/10/19, 05:59 Completed build in 17m 55s on Tue, 10 Sep, 05:59 AM Test Summary: 47382 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36231

  2. Susi Moog commented on patch set 4 09/10/19, 06:24

    can

    AbstractItemProvider.php:1378

    sure about $result instead of $row?

    DataHandler.php:6463

    will generate a notice I guess if the field is not set.
  3. Benni Mack uploaded patch set 5 09/10/19, 09:14

  4. Benni Mack commented on patch set 5 09/10/19, 09:20

    Reply

    Done

    AbstractItemProvider.php:1378 Reply

    Done

    DataHandler.php:6463 Reply

    Done
  5. TYPO3com voted on patch set 5 V +1 09/10/19, 09:25 Completed build in 10m 20s on Tue, 10 Sep, 09:25 AM Test Summary: 47434 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36242

  6. Oliver Hader wrote 09/10/19, 12:50

    Removed reviewer Oliver Hader.
  7. Oliver Hader wrote 09/10/19, 12:50

    Removed reviewer Oliver Hader.
  8. Achim Fritz commented on patch set 5 09/10/19, 13:28

    BackendUtility.php:3722

    do not call the variable "$pidOperator"
  9. Oliver Hader commented on patch set 5 V -1 CR -1 09/10/19, 14:13

    A couple of queries (I did not check all, yet) look wrong (before this patch already)... I'll go through all queries later... this will take some time...

    Clipboard.php:483

    That was wrong before already... it's not relevant whether the parent language record is in a workspace or not. The current context is relevant - e.g. the current state would not show new localizations of a record that is live (since its t3ver_wsid is `0`).

    PageLayoutController.php:1240

    That's what BackendWorkspaceRestriction is doing... besides that, the query does not seem to be correct. If in a workspace, only workspace versions (placeholders in this case, but no live versions) would be selected...
  10. Oliver Hader commented on patch set 5 09/10/19, 17:52

    AbstractItemProvider.php:1381

    Really seems to be superfluous given that AbstractDatabaseRecordProvider::getDatabaseRow() returns all fields (including pid and t3ver_oid)

    EvaluateDisplayConditions.php:894

    might be simplified without array_key_exists (PHP7)

    BackendUserAuthentication.php:911

    might raise a notice in case table is not workspace aware

    PlainDataResolver.php:184

    for these kind of lookups we might pre-filter with array_filter in order to avoid '0' as (invalid) uid

    RelationHandler.php:1561

    for these kind of lookups we might pre-filter with array_filter in order to avoid '0' as (invalid) uid

    MissingRelationsCommand.php:268

    will raise notice in case table is not workspace aware

    DataHandlerHook.php:1268

    only stages of "offline" versions should be modified -> change to t3ver_oid <> 0 condition
  11. Oliver Hader commented on patch set 5 V 0 09/10/19, 21:56

  12. Oliver Hader commented on patch set 5 09/11/19, 09:14

    Clipboard.php:483 Reply

    Ack

    PageLayoutController.php:1240 Reply

    Ack

    AbstractItemProvider.php:1381 Reply

    Done

    EvaluateDisplayConditions.php:894 Reply

    Ack

    BackendUtility.php:3722 Reply

    Ack

    BackendUserAuthentication.php:911 Reply

    Ack

    PlainDataResolver.php:184 Reply

    Ack

    RelationHandler.php:1561 Reply

    Ack

    MissingRelationsCommand.php:268 Reply

    Ack

    DataHandlerHook.php:186

    notices since it might not be workspace aware

    DataHandlerHook.php:1268 Reply Unresolved

    probably it does not matter, so keep it like this
  13. Oliver Hader uploaded patch set 6 09/11/19, 10:36

  14. Oliver Hader voted on patch set 6 CR +1 09/11/19, 10:37

  15. Susi Moog voted on patch set 6 CR +1 09/11/19, 10:42

  16. TYPO3com voted on patch set 6 V -1 09/11/19, 10:49 Completed build in 10m 27s on Wed, 11 Sep, 10:49 AM Test Summary: 3 of 47853 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36291

  17. Oliver Hader voted on patch set 6 V +1 09/11/19, 10:57

  18. TYPO3com commented on patch set 6 09/11/19, 10:59 Completed build in 31m 07s on Wed, 11 Sep, 10:59 AM Test Summary: 3 of 47853 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36291

  19. TYPO3com commented on patch set 6 09/11/19, 11:13 Completed build in 1h 05m 25s on Wed, 11 Sep, 11:13 AM Test Summary: 3 of 47853 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36291

  20. TYPO3com commented on patch set 6 09/11/19, 11:21 Completed build in 1h 48m 18s on Wed, 11 Sep, 11:21 AM Test Summary: 3 of 47853 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36291

  21. Oliver Hader rebased onto patch set 7 09/11/19, 12:05

  22. Oliver Hader voted on patch set 7 V +1 CR +1 09/11/19, 12:06

  23. TYPO3com voted on patch set 7 V +1 09/11/19, 12:42 Completed build in 32m 37s on Wed, 11 Sep, 12:42 PM Test Summary: 47514 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-36305

  24. Susi Moog voted on patch set 7 V +2 CR +2 09/11/19, 12:43

  25. Susi Moog merged patch set 8 09/11/19, 12:44