Review main Abandoned

68846[WIP][FEATURE] Introduce ActiveExtensions API in favor of PackageStates

Benni Mack CR 0 V 0 Normal +162 −7 updated 08/04/21, 11:16

Commit message

The current PackageStates.php file has several downsides:
* It is located at a fixed place (even in composer mode)
* It does not contain any version information or composer-package name information
* It has to be recreated when the system changes
* There is no proper API to access this information with the PackageManager

A new API class called ActiveExtensions will act as an add-on / replacement
for PackageStates which is fully composer-aware.

For composer-mode this class should be generated during build-time
(via TYPO3's composer plugin).

For the non-composer mode, this class will be generated
along PackageStates.php with additional information
and placed under typo3conf/ActiveExtensions.php until
several other concepts have been re-thought (f.e. "active" vs.
"inactive" extensions).

Every time the PackageStates.php is updated, the ActiveExtensions.php
class is updated as well, and via spl_autoload loaded and always
available when PackageManager handles situations.

One of the main benefits is that TYPO3 does not need to generate
PackageStates in composer mode anymore (only for legacy reasons).

ToDo:
* Enhance PackageManager to also fetch version (from ext_emconf.php) and composer package name for ActiveExtensions.php
* Think about the API and what should be accessed
* Replace all occurrences of PackageManager with ActiveExtensions API
* Properly test Failsafe Mode, test activating / deactivating an extension
* Create a fallback when the class does not exist ("dynamically create the class and load it)
* Write RST file for it
* Adapt tests
* Adapt composer mode / composer plugin

Review

  • Code review CR 0
  • Verified V 0

Files 3

Review log 610

  1. Benni Mack uploaded patch set 1 04/23/21, 10:16

  2. TYPO3com voted on patch set 1 V -1 04/23/21, 10:16 Completed build in 10s on Fri, 23 Apr, 10:16 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10822

  3. core-ci voted on patch set 1 V -1 04/23/21, 10:17 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10630

  4. Benni Mack updated the commit message in patch set 2 04/23/21, 10:20

  5. TYPO3com voted on patch set 2 V -1 04/23/21, 10:20 Completed build in 18s on Fri, 23 Apr, 10:20 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10823

  6. core-ci voted on patch set 2 V -1 04/23/21, 10:22 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/10631

  7. Helmut Hummel commented on patch set 2 04/26/21, 09:27

    ActiveExtensionsTrait.php:60

    right from the start I would generate two arrays for the ActiveExtensions class. one indexed by composer name containing the actual meta data for the packages, and a second map, which contains all possible aliases for a package as key and the canonical name (the composer name) as value.
  8. Jochen Roth commented on patch set 2 04/27/21, 07:11

    ActiveExtensionsTrait.php:60 Reply Unresolved

    Not sure if i got you right. This extensions array should look like this? private array $extensions = [ 'typo3/cms-core' => [ 'extKey' => 'core', 'composerPackage' => 'typo3/cms-core', 'version' => 'dev-master', 'path' => '/Volumes/Development/typo3-dev-composer/public/typo3/sysext/core', ], ] The additional map array should like this? private array $packageMapIncludingReplacements = [ 'typo3/cms-adminpanel' => 'typo3/cms-adminpanel', 'typo3-ter/news' => 'georgringer/news', // replace setion from composer.json 'georgringer/news' => 'georgringer/news' ] I would suggest to add a additional extension->packageName map (maybe just for now): private array $extKeyPackageMap = [ 'adminpanel' => 'typo3/cms-adminpanel', ] So we can still get packages by extension key. Feel free to text me on slack
  9. Benjamin Franzke commented on patch set 2 04/29/21, 17:13

    I would really love if we'd just parse vendor/composer/installed.json (what a pity that's not defined as API) in PackageManager (of course only in composer mode) and cache that via our caching frameework. No dynamic class generation, no composer plugin-fu (please remember how unstable updates of composer plugins are/were), contains all we need (even the "extra" section that PackageManager usually reads from composer.json), and it could simply be cache-warmed together with all other caches via https://review.typo3.org/c/Packages/TYPO3.CMS/+/61645
  10. Benni Mack abandoned the change 08/04/21, 11:16