src/controllers/ExtensionsController.php
private static function activate($extension, ReportingChain $chain)
    {
        if ($extension['is_active'] == 0) {
            ExtensionDataHelper::prepareMigrationTask(
                $extension,
                $chain,
                ExtensionsManager::MIGRATE_TYPE_UP,
                ExtensionsManager::EXTENSION_ACTIVATE_DEFERRED_GROUP
            );
            $activationTask = ExtensionDataHelper::buildTask(
                [
                    realpath(Yii::getAlias('@app') . '/yii'),
                    'extension/activate',
                    $extension['composer_name'],
                ],
                ExtensionsManager::EXTENSION_ACTIVATE_DEFERRED_GROUP
            );
            $chain->addTask($activationTask);
        } else {
            $dummyTask = ExtensionDataHelper::buildTask(
                [
                    realpath(Yii::getAlias('@app') . '/yii'),
                    'extension/dummy',
                    'Extension already activated!',
                ],
                ExtensionsManager::EXTENSION_DUMMY_DEFERRED_GROUP
            );
            $chain->addTask($dummyTask);
        }
    }
private static function activate($extension, ReportingChain $chain)
    {
        if ($extension['is_active'] == 0) {
            ExtensionDataHelper::prepareMigrationTask(
                $extension,
                $chain,
                ExtensionsManager::MIGRATE_TYPE_UP,
                ExtensionsManager::EXTENSION_ACTIVATE_DEFERRED_GROUP
            );
            $activationTask = ExtensionDataHelper::buildTask(
                [
                    realpath(Yii::getAlias('@app') . '/yii'),
                    'extension/activate',
                    $extension['composer_name'],
                ],
                ExtensionsManager::EXTENSION_ACTIVATE_DEFERRED_GROUP
            );
            $chain->addTask($activationTask);
        } else {
            $dummyTask = ExtensionDataHelper::buildTask(
                [
                    realpath(Yii::getAlias('@app') . '/yii'),
                    'extension/dummy',
                    'Extension already activated!',
                ],
                ExtensionsManager::EXTENSION_DUMMY_DEFERRED_GROUP
            );
            $chain->addTask($dummyTask);
        }
    }
Adds activation task into ReportingChain if Extension is not active

@param array $extension
@param ReportingChain $chain