Review main Merged

64598[TASK] Avoid usages of TYPO3_MODE

Benni Mack CR +2 V +2 Normal +62 −22 updated 06/02/20, 14:37

Commit message

All code that is using the constant TYPO3_MODE is hard to test,
as this needs to be encapsulated into various places. All testing framework
places run with TYPO3_MODE=FE which makes it impossible to even
consider making parts of the testing framework compatible running a pure
Frontend-based request in the future.

On top, the constant covers up cross-dependency between core dependencies
(whereas $GLOBALS[TSFE]->fe_user is actually a dependency to EXT:frontend).

Another testing-helper in Extbase's EnvironmentService allows to switch
within Extbase to simulate Frontend behaviour.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Wouter Wolters +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Andreas Kienast +1
    • TYPO3com +1 CI

Issues 1

Files 10

Review log 1113

  1. Benni Mack uploaded patch set 1 05/29/20, 11:04

  2. TYPO3com voted on patch set 1 V -1 05/29/20, 12:07 Completed build in 1h 02m 31s on Fri, 29 May, 12:07 PM Test Summary: 24 of 72581 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3625

  3. Benni Mack uploaded patch set 2 05/29/20, 18:43

  4. TYPO3com voted on patch set 2 V +1 05/29/20, 19:00 Completed build in 14m 29s on Fri, 29 May, 07:00 PM Test Summary: 73093 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3645

  5. Wouter Wolters voted on patch set 2 CR +1 05/29/20, 19:17

  6. Andreas Kienast voted on patch set 2 V +1 CR +1 06/02/20, 05:56

  7. Benjamin Franzke voted on patch set 2 CR +1 06/02/20, 12:17

  8. Benjamin Franzke commented on patch set 2 CR -1 06/02/20, 12:51

    AbstractRepository.php:303

    Hm.. This would this be a breaking change for eIDs where TSFE is not initialized, but they are supposed to be "frontend" as well (and therefore need/want the FrontendRestrictionContainer in doctrine queries). Usecase: A processed image (e.g. cropped) in a non-public FAL storage. This would result in usage of the ProcessedFileRepository (from within the eID FileDumpController), which would then create doctrine queries without the FrontendRestrictionContainer because getEnvironmentMode() returns 'BE'.

    FormRuntime.php:1011 Unresolved

    I wonder when this case is actually triggered? In frontend mode I actually never run into this else block, as the language attribute is always available when TSFE is. Still, the code is not wrong, just looks like it is never executed.
  9. Benjamin Franzke commented on patch set 2 06/02/20, 12:58

    AbstractRepository.php:303 Reply

    My suggestion would be to add one middleware to backend/installtool and one middleware to frontend and set a static mode attribute on the PSR-7 request in each of these.
  10. Benni Mack commented on patch set 2 06/02/20, 13:24

    AbstractRepository.php:303 Reply

    Please check what happens if this is set to 'FE' - then this would use the FrontendRestrictionContainer which then would use the native Context API for populating the restrictions for Workspace+FE Groups, having basically no effect as they haven't been set in eID scripts. The default restriction container would then apply now for eID scripts, which is the same effect as the FrontendRestrictionCOntainer without the settings set.
  11. Benjamin Franzke commented on patch set 2 CR +1 06/02/20, 14:04

    AbstractRepository.php:303 Reply

    Hm, true, I somehow thought HiddenRestricton would be required for files, but it obviously isn't needed. Therefore this is fine by me.
  12. Benjamin Franzke voted on patch set 2 V +2 CR +2 06/02/20, 14:37

  13. Benjamin Franzke merged patch set 3 06/02/20, 14:37