@param ModuleSetting $moduleSetting
@param string        $moduleId
@param int           $shopId

@throws WrongModuleSettingException
182098
public function handleOnModuleActivation(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
    {
        if (!$this->canHandle($moduleSetting)) {
            throw new WrongModuleSettingException($moduleSetting, self::class);
        }

        $shopConfigurationSetting = $this->getShopConfigurationSetting($shopId);

        $shopSettingValue = array_merge(
            $shopConfigurationSetting->getValue(),
            [
                $moduleId => $moduleSetting->getValue(),
            ]
        );

        $shopConfigurationSetting->setValue($shopSettingValue);

        $this->shopConfigurationSettingDao->save($shopConfigurationSetting);
    }
120212
public function moduleUpdate(SettingModuleRequest $request, Module $module)
    {
        $this->model::moduleUpdate($module, $request->all());
        
        $route = \Route::has('admin.'.$module->name.'.index') ? 'admin.'.$module->name.'.index' : 'dashboard';
        
        return $this->makeRedirect(true, $route, __('msg_update'));
    }
718220
public function disable($module_id)
    {
        try {
            $result = $this->canDisable($module_id);
        } catch (Exception $ex) {
            $result = $ex->getMessage();
        }

        $this->hook->attach("module.disable.before|$module_id", $result, $this);

        if ($result !== true) {
            return $result;
        }

        if ($this->module->isInstalled($module_id)) {
            $this->module->update($module_id, array('status' => false));
        } else {
            $this->module->add(array('status' => false, 'module_id' => $module_id));
        }

        $this->setOverrideConfig();

        $this->hook->attach("module.disable.after|$module_id", $result, $this);
        return $result;
    }
241279
public function deleteShopConfiguration(int $shopId)
    {
        if (array_key_exists($shopId, $this->shopConfigurations)) {
            unset($this->shopConfigurations[$shopId]);
        } else {
            throw new DomainException('There is no configuration for shop id ' . $shopId);
        }
    }
728515
public function outputModule($module, $args = array(), $moduleSettings = array(), $echo = true)
    {
        if (!isset($args['id'])) {
            $args['id'] = 'no-id';
        }

        if (!is_object($module)) {
            return false;
        }

        $class = \Modularity\ModuleManager::$classes[$module->post_type];
        $module = new $class($module, $args);
        $module = $this->fillMissingParams($module, $moduleSettings);

        if (!$echo || !isset($moduleSettings['cache_ttl'])) {
            $moduleSettings['cache_ttl'] = 0;
        }

        $cache = new \Modularity\Helper\Cache($module->ID, array($module, $args['id']), $moduleSettings['cache_ttl']);

        if (empty($moduleSettings['cache_ttl']) || $cache->start()) {
            $moduleMarkup = $this->getModuleMarkup($module, $args);

            if (isset($module->columnWidth) && !empty($module->columnWidth)) {
                $moduleMarkup .= apply_filters('Modularity/Display/AfterModule', '</div>', $args, $module->post_type, $module->ID);
            } elseif (isset($this->options[$args['id']]['after_module']) && !empty($this->options[$args['id']]['after_module'])) {
                $moduleMarkup .= apply_filters('Modularity/Display/AfterModule', '</div>', $args, $module->post_type, $module->ID);
            } elseif (isset($args['after_widget'])) {
                $moduleMarkup .= apply_filters('Modularity/Display/AfterModule', $args['after_widget'], $args, $module->post_type, $module->ID);
            }

            $moduleMarkup = apply_filters('Modularity/Display/Markup', $moduleMarkup, $module);
            $moduleMarkup = apply_filters('Modularity/Display/' . $module->post_type . '/Markup', $moduleMarkup, $module);

            if (!$echo) {
                return $moduleMarkup;
            }

            echo $moduleMarkup;

            if (!empty($moduleSettings['cache_ttl'])) {
                $cache->stop();
            }
        }

        return true;
    }
455110
public static PmiModuleConfig findConfig(PmiModuleConfig[] configs, String moduleID) {
        if (moduleID == null)
            return null;

        for (int i = 0; i < configs.length; i++) {
            if (configs[i].getUID().equals(moduleID)) // VELA
                //configs[i].getShortName().equals(moduleID))
                return configs[i];
        }
        return null;
    }
36327
public function activate(string $moduleId, int $shopId)
    {
        if ($this->stateService->isActive($moduleId, $shopId) === true) {
            throw new ModuleSetupException('Module with id "'. $moduleId . '" is already active.');
        }

        $moduleConfiguration = $this->moduleConfigurationDao->get($moduleId, $shopId);

        $this->moduleSettingsHandlingService->handleOnActivation($moduleConfiguration, $shopId);

        $this->moduleServicesActivationService->activateModuleServices($moduleId, $shopId);

        $this->stateService->setActive($moduleId, $shopId);

        $moduleConfiguration->setAutoActive(true);
        $this->moduleConfigurationDao->save($moduleConfiguration, $shopId);

        $this->classExtensionChainService->updateChain($shopId);

        $this->eventDispatcher->dispatch(
            FinalizingModuleActivationEvent::NAME,
            new FinalizingModuleActivationEvent($shopId, $moduleId)
        );
    }
954888
public function getModuleConfiguration(string $moduleId) : ModuleConfiguration
    {
        if (array_key_exists($moduleId, $this->moduleConfigurations)) {
            return $this->moduleConfigurations[$moduleId];
        }
        throw new DomainException('There is no module configuration with id ' . $moduleId);
    }
865485
protected function getModuleConfigs($moduleId)
    {
        $db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $shopId = $config->getShopId();
        $module = $this->getModuleConfigId($moduleId);

        $decodeValueQuery = $config->getDecodeValueQuery();
        $moduleConfigsQuery = "SELECT oxvarname, oxvartype, {$decodeValueQuery} as oxvardecodedvalue FROM oxconfig WHERE oxmodule = ? AND oxshopid = ?";
        $dbConfigs = $db->getAll($moduleConfigsQuery, [$module, $shopId]);

        $result = [];
        foreach ($dbConfigs as $oneModuleConfig) {
            $result[$oneModuleConfig['oxvarname']] = $config->decodeValue($oneModuleConfig['oxvartype'], $oneModuleConfig['oxvardecodedvalue']);
        }

        return $result;
    }
791959
public function setActive(string $moduleId, int $shopId)
    {
        if ($this->isActive($moduleId, $shopId)) {
            throw new ModuleStateIsAlreadySetException(
                'Active status for module "' . $moduleId . '" and shop with id "' . $shopId . '" is already set.'
            );
        }

        $activeModuleIdsSetting = $this->getActiveModulesShopConfigurationSetting($shopId);

        $activeModuleIds = $activeModuleIdsSetting->getValue();
        $activeModuleIds[] = $moduleId;
        $activeModuleIdsSetting->setValue($activeModuleIds);

        $this->shopConfigurationSettingDao->save($activeModuleIdsSetting);
    }
898267
protected function _loadVarsFromDb($shopID, $onlyVars = null, $module = '')
    {
        $db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        $moduleSql = $module ? " oxmodule LIKE " . $db->quote($module . "%") : " oxmodule='' ";
        $onlyVarsSql = $this->_getConfigParamsSelectSnippet($onlyVars);

        $select = "select
                        oxvarname, oxvartype, " . $this->getDecodeValueQuery() . " as oxvarvalue
                    from oxconfig
                    where oxshopid = '$shopID' and " . $moduleSql . $onlyVarsSql;

        $result = $db->getAll($select);

        foreach ($result as $value) {
            $varName = $value[0];
            $varType = $value[1];
            $varVal = $value[2];

            $this->_setConfVarFromDb($varName, $varType, $varVal);

            //setting theme options array
            if ($module) {
                $this->_aThemeConfigParams[$varName] = $module;
            }
        }

        return (bool) count($result);
    }
150106
function setModulesDir($modulesDir)
    {
        if (is_string($modulesDir))
            $modulesDir = array($modulesDir);

        $this->modulesDir = array_merge($this->modulesDir, $modulesDir);
        return $this;
    }
688198
protected function updateRegisteredModule($moduleName)
    {
        $module = $this->findOrFalse('module_name', $moduleName);
        $module->module_version = $this->def($moduleName, 'version');
        $module->module_is_updated = 1;
        $module->save();
    }
981723
public void addExtraModule(String moduleId) {
		if (extraModules == null) {
			extraModules = new LinkedList<String>();
		}
		extraModules.add(moduleId);
	}
312256
private JpaSoftwareModule touch(final Long moduleId) {
        return touch(get(moduleId).orElseThrow(() -> new EntityNotFoundException(SoftwareModule.class, moduleId)));
    }
1098632
protected function filterModuleConfig($moduleConfig, $moduleName)
    {
        if (!ArrayUtils::isHashTable($moduleConfig, true)) {
            $errMsg = sprintf('The configuration for module "%s" is invalid', $moduleName);
            throw new Exception\RuntimeException($errMsg);
        }

        if (isset($moduleConfig['view'])) {
            $realPathView = realpath($moduleConfig['view'][$moduleName]);
            if (!$realPathView) {
                $errMsg = sprintf('The view path for module "%s" is invalid', $moduleName);
                throw new Exception\RuntimeException($errMsg);
            }
            $moduleConfig['view'][$moduleName] = $realPathView;
        }
        
        if (isset($moduleConfig['volt']) && isset($moduleConfig['volt'][$moduleName]['path'])) {
            $path = realpath($moduleConfig['volt'][$moduleName]['path']);
            unset($moduleConfig['volt'][$moduleName]['path']);
            if ($path) {
                $moduleConfig['volt'][$moduleName]['path'] = $path;
            }
        }

        return $moduleConfig;
    }
1317885
public static String getModuleVersion(final String moduleId) {
        final int splitter = moduleId.lastIndexOf(':');
        if(splitter == -1){
            return moduleId;
        }
        return moduleId.substring(splitter+1);
    }