Project

General

Profile

Actions

Feature #101909

open

Make it possible to activate / deactive packages (extensions) from Feature toggles

Added by Stig Nørgaard Færch 8 months ago. Updated 4 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
System/Bootstrap/Configuration
Target version:
Start date:
2023-09-13
Due date:
% Done:

0%

Estimated time:
PHP Version:
8.1
Tags:
Complexity:
Sprint Focus:

Description

We have extension A and the new extension B. In extension A we have added som feature toggles on code that uses extension B.
Currently on our testing site we activate the featuretoggle to test things, but manually have to add the extension B package from composer, breaking our deploy setup.
Also we might want to test the new feature on only one of multiple Production/Live instances of the same TYPO3 solution, which also presents the same problem.
It would be nice if we could add extension B to the main branch and have it activated through the feature toggle.

Actions #1

Updated by Stig Nørgaard Færch 8 months ago

  • Tracker changed from Bug to Feature
  • TYPO3 Version deleted (11)
Actions #2

Updated by Stig Nørgaard Færch 8 months ago

Just experimented a bit with the PackageManager and got something working, though of course not tested thoroughly, and it may or maybe not be a viable solution:

\TYPO3\CMS\Core\Package\PackageManager::getActivePackages

   public function getActivePackages()
    {
        if (empty($this->activePackages)) {
            if (!empty($this->packageStatesConfiguration['packages'])) {
                foreach ($this->packageStatesConfiguration['packages'] as $packageKey => $packageConfig) {
                    $addAsActivePackage = true;
                    if($GLOBALS['TYPO3_CONF_VARS']['SYS']['enableExtensionByFeatureToggle'][$packageKey] ?? false) {
                        $addAsActivePackage = GeneralUtility::makeInstance(Features::class)->isFeatureEnabled($GLOBALS['TYPO3_CONF_VARS']['SYS']['enableExtensionByFeatureToggle'][$packageKey]);
                    }
                    if($addAsActivePackage) $this->activePackages[$packageKey] = $this->getPackage($packageKey);
                }
            }
        }
        return $this->activePackages;
    }

So I my additionalConfiguration.php file, I would of course have my feature toggle settings and this new one:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['enableExtensionByFeatureToggle']['news'] = 'myFeatureName';

Actions #3

Updated by Stig Nørgaard Færch 8 months ago

As some points out on Slack. My suggestion to a solution might bring big trouble as patching getActivePackages for runtime extensions might introduce a lot of DI-cache and other TYPO3-cache issues...

For my example, one suggests me make anything in the extension B gated from the feature toggle as well. That could be a lot of conditions all over. Another point is, that this might be a 3rd party extension, and not a in house extension. So that would require to hack the extension instead.

Actions #4

Updated by Benni Mack 3 months ago

  • Target version changed from 13.0 to 13.1
Actions #5

Updated by Benni Mack 4 days ago

  • Target version changed from 13.1 to 13.2
Actions

Also available in: Atom PDF