Activate extension by merging module class inheritance information with shop module array

@param \OxidEsales\Eshop\Core\Module\Module $module

@return bool
354079
public function activate(\OxidEsales\Eshop\Core\Module\Module $module)
    {
        $result = false;
        if ($moduleId = $module->getId()) {
            $this->_addExtensions($module);
            $this->_removeFromDisabledList($moduleId);

            if (version_compare($module->getMetaDataVersion(), '2.0', '<')) {
                /** Support for the key 'files' was removed in MetaData version 2.0 */
                $this->_addModuleFiles($module->getInfo("files"), $moduleId);
            }

            $this->_addTemplateBlocks($module->getInfo("blocks"), $moduleId);
            $this->_addTemplateFiles($module->getInfo("templates"), $moduleId);
            $settingsHandler = oxNew(SettingsHandler::class);
            $settingsHandler->setModuleType('module')->run($module);
            $this->_addModuleVersion($module->getInfo("version"), $moduleId);
            $this->_addModuleExtensions($module->getExtensions(), $moduleId);
            $this->_addModuleEvents($module->getInfo("events"), $moduleId);

            if (version_compare($module->getMetaDataVersion(), '2.0', '>=')) {
                try {
                    /** Support for the key 'controllers' was added in MetaData version 2.0 */
                    $this->addModuleControllers($module->getControllers(), $moduleId);
                } catch (ModuleValidationException $exception) {
                    $this->deactivate($module);
                    $lang = Registry::getLang();
                    $message = sprintf($lang->translateString('ERROR_METADATA_CONTROLLERS_NOT_UNIQUE', null, true), $exception->getMessage());

                    $standardException = oxNew(StandardException::class);
                    $standardException->setMessage($message);

                    throw $standardException;
                }
            }

            if (version_compare($module->getMetaDataVersion(), '2.1', '>=')) {
                try {
                    $this->addModuleSmartyPluginDirectories($module);
                } catch (\Exception $exception) {
                    $this->deactivate($module);

                    throw oxNew(StandardException::class, $exception->getMessage());
                }
            }

            $this->activateShopAwareServices($module);

            $this->resetCache();

            $this->_callEvent('onActivate', $moduleId);

            $result = true;
        }

        return $result;
    }
1266737
public function unloadModule($module)
    {
        $modules = $module;
        if (!is_array($module)) {
            $modules = [];
            $modules[] = $module;
        }

        $moduleLoadFile = $_SERVER['DOCUMENT_ROOT'] . '/../config/melis.module.load.php';

        if (file_exists($moduleLoadFile)) {
            $loadModules = include $moduleLoadFile;

            foreach ($loadModules as $idx => $loadedModule) {
                if (in_array($loadedModule, $modules)) {
                    unset($loadModules[$idx]);
                }
            }

            $this->createModuleLoader('config/', $loadModules, [], []);
        }

        return false;
    }
781978
public function setModules($modules)
	{
		foreach ($modules as $name => $module) {
		    $this->setModule($name, $module);
		}
		
		return $this;
	}
943634
public function activateModules($modulesToActivate)
    {
        $this->clearModuleChain();

        // First load all needed config options before the module will be installed.
        $this->prepareModulesForActivation();
        foreach ($modulesToActivate as $modulePath) {
            $this->installModule($modulePath);
        }

        // Reset reverse proxy backend as module activation sets it to flush mode.
        \OxidEsales\Eshop\Core\Registry::set(\OxidEsales\Eshop\Core\Cache\ReverseProxy\ReverseProxyBackend::class, null);
    }
1002812
public static function remove_module( $module ) {
		$key = array_search( $module, self::$modules, true );
		if ( false !== $key ) {
			unset( self::$modules[ $key ] );
		}
	}
1242698
public function addModule(Module $module)
    {
        if ($this->db !== $module->getDB())
            throw new MigrationException("The DB instances should be the same");

        $name = self::normalizeModule($module->getModule());
        $this->modules[$name] = $module;
        return $this;
    }
512838
public function register(DynamicModule $module)
    {
        if(!is_null($module) && ! empty($module->getModule()) ) {

            self::getRegistry()->set($module->getModule(), $module->toArray());

            return true;
        }
        return false;
    }
1347799
protected function isConfiguredModulePresenceDisabled(ModuleInterface $module)
    {
        if ( ! array_key_exists($module->getKey(), $this->configModules)) {
            return false;
        }

        return false === $this->configModules[ $module->getKey() ];
    }
169126
public function hasModule($module)
    {
        return $module instanceof ModuleInterface
            ? in_array($module, $this->modules)
            : isset($this->modules[$module]);
    }
1024683
public function addModule(Module $module)
    {
        $name = $module->getName();
        if (isset($this->modules[$name])) {
            throw new \LogicException(sprintf('Trying to register two modules with the same name "%s"', $name));
        }
        $this->view->addTemplatePath($module->getPath() . '/Resources/views');
        $this->modules[$name] = $module;
        
        return $this;
    }
232095
public function enable(Module $module, bool $recollect = true, bool $recursive = false): bool
    {
        $action = function (Module $module): bool {
            $installer = $module->installer();
            if ($installer === null) {
                return true;
            }

            if (!class_exists($installer) || !is_subclass_of($installer, Installer::class, true)) {
                return false;
            }

            /** @var Installer $installer */
            $installer = new $installer($module);
            try {
                $installer->enable();
                return true;
            } catch (Throwable $e) {
                $installer->enableError($e);
                return false;
            }
        };

        $callback = function (Module $module) use ($recollect) {
            $this->notify($module, 'enabled', true);

            if ($recollect) {
                $this->getCollector()->recollect();
            }

            $this->emit('module.enabled.' . $module->name());
        };

        $manager = $this->moduleManager();

        if ($recursive) {
            foreach ($manager->recursiveDependencies($module) as $dependency) {
                if (!$dependency->isInstalled()) {
                    if (!$this->install($dependency, $recollect, false)) {
                        return false;
                    }
                }
                if (!$dependency->isEnabled()) {
                    if (!$manager->enable($dependency, $action, $callback)) {
                        return false;
                    }
                }
            }

            if (!$module->isInstalled() && !$this->install($module, $recollect, false)) {
                return false;
            }
        }

        return $manager->enable($module, $action, $callback);
    }
1129997
public static function isDebugModeEnabled(Module $module)
    {
        return Craft::$app->getConfig()->getGeneral()->devMode ||
            ($module instanceof LoggableInterface && $module->isDebugModeEnabled());
    }
801992
public function activateModule()
    {
        if (\OxidEsales\Eshop\Core\Registry::getConfig()->isDemoShop()) {
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay('MODULE_ACTIVATION_NOT_POSSIBLE_IN_DEMOMODE');

            return;
        }

        $sModule = $this->getEditObjectId();
        /** @var \OxidEsales\Eshop\Core\Module\Module $oModule */
        $oModule = oxNew(\OxidEsales\Eshop\Core\Module\Module::class);
        if (!$oModule->load($sModule)) {
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay(new \OxidEsales\Eshop\Core\Exception\StandardException('EXCEPTION_MODULE_NOT_LOADED'));

            return;
        }
        try {
            /** @var \OxidEsales\Eshop\Core\Module\ModuleCache $oModuleCache */
            $oModuleCache = oxNew('oxModuleCache', $oModule);
            /** @var \OxidEsales\Eshop\Core\Module\ModuleInstaller $oModuleInstaller */
            $oModuleInstaller = oxNew('oxModuleInstaller', $oModuleCache);

            if ($oModuleInstaller->activate($oModule)) {
                $this->_aViewData["updatenav"] = "1";
            }
        } catch (\OxidEsales\Eshop\Core\Exception\StandardException $exception) {
            Registry::getUtilsView()->addErrorToDisplay($exception);
            Registry::getLogger()->error($exception->getMessage(), [$exception]);
        }
    }
1205396
public function deleteAllByModule($module)
    {
        $query = sprintf('DELETE FROM `%s` WHERE `module` =:module', $this->table);

        $stmt = $this->pdo->prepare($query);
        return $stmt->execute(array(
            ':'.ConstProviderInterface::CONFIG_PARAM_MODULE => $module
        ));
    }
607624
public static function get($module) {
		if(self::$modules === array())
			self::initialize();

		if(!isset(self::$modules[$module]))
			return false;

		return self::$modules[$module];
	}
102830
public function getModuleDeps($module)
    {
        $module = strtolower($module);
        
        if (!isset($this->deps[$module])) {
            $map     = array();
            $deps    = array();
            $modules = $this->findModules();
    
            foreach ($modules as $name) {
                $config     = $this->getModuleDefinition($name);
                $map[$name] = isset($config['name']) ? $config['name'] : null;
            }
    
            $config = $this->getModuleDefinition($module);
            
            foreach (['require', 'require-dev'] as $key) {
                if (isset($config[$key])) {
                    foreach ($config[$key] as $composerName => $composerVersion) {
                        $moduleName = array_search($composerName, $map);
        
                        if ($moduleName !== false) {
                            $deps[$moduleName] = ltrim($composerVersion, '<>=');
                        }
                    }
                }
            }
    
            $this->deps[$module] = $deps;
        }
    
        return $this->deps[$module];
    }
1126535
private function getSubmodules(ModuleInterface $module)
    {
        if ($module instanceof SubmoduleInterface) {
            $module = $this->getModule($module->getParentIdentifier());
        }

        return $this->get('clastic.module_manager')
            ->getSubmodules($module->getIdentifier());
    }