Review main Merged Breaking

82650[!!!][FEATURE] Add PSR-14 PackageInitializationEvent

Oli Bartsch CR +2 V +2 Expert +1270 −479 updated 01/28/24, 15:26

Commit message

This adds the PSR-14 PackageInitializationEvent. The Event
is being dispatched when packages are set up. TYPO3 Core
registers listeners, which execute corresponding tasks, such
as importing static extension data.

Note this in not about loading / unloading of extensions
in non-composer mode, but about setting up extensions
after being loaded in non-composer by extensionmanager,
or after being composer require'd (and thus auto-loaded)
in composer mode.

This allows to resolve dependencies to EXT:extensionmanager,
which is therefore now optional and can be omitted for composer
based installations. Activating packages can now be done by
calling the new PackageActivationService. This service does
also dispatch the new PSR-14 Event.

The former functionality in `InstallUtility->install()` is moved
to the new PackageActivationService. Therefore, the method now
only acts as wrapper around the new service, allowing listeners
to the AfterPackageActivationEvent to work as before.

However, following PSR-14 Events are removed from extension manager:

* AfterExtensionDatabaseContentHasBeenImportedEvent
* AfterExtensionFilesHaveBeenImportedEvent
* AfterExtensionSiteFilesHaveBeenImportedEvent
* AfterExtensionStaticDatabaseContentHasBeenImportedEvent

The information provided by those events can now be retrieved
by listeners to the PackageInitializationEvent using the event's
storage entries. Those entries are a PackageInitializationResult
object, providing the listener's result. By convention, the
identifier of the entries is the listener class name.

Using `before` and `after` in the listener registration it's
possible to place own listeners at a specific place, having
the necessary information available.

Additionally, the `InstallUtility->processExtensionSetup()` method
is removed. This method just triggered the corresponding tasks,
which can now be triggered by dispatching the new event.

With the new `CheckForImportRequirements` listener, TYPO3 checks
whether an extensions tries to import data, while required
components (e.g. EXT:impexp) are not installed. Instead of a
PHP Error, a warning is now logged in such case. If the package
activation is triggered via the `extension:setup` command, which
has been moved to EXT:core, the warning is also displayed on CLI.

Review

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

Issues 1

Files 35

Show 15 more files

Review log 2640

Show 915 earlier messages
  1. Oli Bartsch uploaded patch set 1 01/25/24, 23:25

  2. core-ci voted on patch set 1 V -1 01/25/24, 23:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52207

  3. Oli Bartsch uploaded patch set 2 V -1 01/26/24, 08:18

  4. core-ci voted on patch set 2 V +1 01/26/24, 08:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52213

  5. Oli Bartsch uploaded patch set 3 V +1 01/26/24, 22:45

  6. Oli Bartsch uploaded patch set 4 01/26/24, 22:49

  7. core-ci voted on patch set 3 V -1 01/26/24, 22:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52272

  8. Oli Bartsch uploaded patch set 5 01/26/24, 23:01

  9. core-ci voted on patch set 4 V -1 01/26/24, 23:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52273

  10. core-ci voted on patch set 5 V +1 01/26/24, 23:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52274

  11. Benni Mack commented on patch set 5 01/26/24, 23:14

    ActionController.php:168

    I would actually have this "logic" also in the same code base as the activation stuff, wdyt?
  12. Oli Bartsch uploaded patch set 6 V +1 01/26/24, 23:39

  13. core-ci voted on patch set 6 V -1 01/26/24, 23:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52275

  14. Oli Bartsch updated the commit message in patch set 7 V -1 01/27/24, 00:00

  15. Oli Bartsch commented on patch set 7 01/27/24, 00:00

    ActionController.php:168 Reply

    Done
  1. Oli Bartsch uploaded patch set 8 01/27/24, 00:01

  2. core-ci voted on patch set 7 V -1 01/27/24, 00:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52276

  3. core-ci voted on patch set 8 V +1 01/27/24, 00:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52277

  4. Oli Bartsch uploaded patch set 9 V +1 01/27/24, 08:29

  5. core-ci voted on patch set 9 V +1 01/27/24, 08:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52283

  6. Oli Bartsch uploaded patch set 10 V +1 01/27/24, 10:23

  7. core-ci voted on patch set 10 V +1 01/27/24, 10:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52284

  8. Simon Schaufelberger commented on patch set 10 01/27/24, 13:11

    SetupExtensionsCommand.php:18

    Why is this moved to core? Setting up extensions is a responsibility of the extension manager, or? Be aware that this command is heavily used in typo3 console and other applications like surf!!!
  9. Christian Kuhn commented on patch set 10 CR -1 01/27/24, 18:54

    on it.
  10. Christian Kuhn commented on patch set 10 01/27/24, 18:57

    SetupExtensionsCommand.php:18 Reply

    this is not about loading / unloading extensions, but about setting them up. the deal ist: EM is for non-composer. Stuff that needs to be done in composer mode as well, should be part of the core. this allows unloading EM in composer mode. Thus the patch. Clarified this in the commit message now.
  11. Christian Kuhn uploaded patch set 11 CR -1 V +1 01/27/24, 19:09

  12. core-ci voted on patch set 11 V +1 01/27/24, 19:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52319

  13. Christian Kuhn uploaded patch set 12 V +1 01/27/24, 20:19

  14. Simon Schaufelberger voted on patch set 12 CR +1 01/27/24, 20:22

  15. core-ci voted on patch set 12 V +1 01/27/24, 20:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52328

  16. Benni Mack updated the commit message in patch set 13 CR +1 V +1 01/27/24, 21:32

  17. core-ci voted on patch set 13 V +1 01/27/24, 21:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52332

  18. Benni Mack commented on patch set 13 01/27/24, 22:55

    We use AE (except for a few places), thus we use "initialize" instead of "initialise" in 1200+ places already. I would recommend to rename the event as such
  19. Oli Bartsch uploaded patch set 14 V +1 01/28/24, 11:41

  20. Oli Bartsch commented on patch set 14 01/28/24, 11:46

    Reply

    Actually the whole initialization functionality for static data, assets, sites, etc. uses the ext/Initialisation/* directory. However, reworked the patch to always use AE except for the directory references.
  21. core-ci voted on patch set 14 V +1 01/28/24, 11:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52356

  22. Benni Mack voted on patch set 14 CR +1 V +1 01/28/24, 12:30

  23. Christian Kuhn voted on patch set 14 CR +1 V +1 01/28/24, 12:36

  24. Oli Bartsch voted on patch set 14 CR +2 V +2 01/28/24, 15:26

  25. Oli Bartsch merged patch set 15 01/28/24, 15:26