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

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

        $shopControllerClassMap = $this->shopAdapter->getShopControllerClassMap();

        $controllerClassMap = array_merge(
            $shopControllerClassMap,
            $this->getModulesControllerClassMap($shopId)
        );

        $this->validateForControllerKeyDuplication($moduleSetting, $controllerClassMap);
        $this->validateForControllerNamespaceDuplication($moduleSetting, $controllerClassMap);
    }
106715
@Override
    public void initModule() throws ModuleInitializationException {

        String dsMediation = getParameter("doMediateDatastreams");
        if (dsMediation == null) {
            throw new ModuleInitializationException("doMediateDatastreams parameter must be specified.",
                                                    getRole());
        }
    }
103351
public function initVars($shopID)
    {
        $this->_loadVarsFromFile();

        $this->_setDefaults();

        $configLoaded = $this->_loadVarsFromDb($shopID);
        // loading shop config
        if (empty($shopID) || !$configLoaded) {
            // if no config values where loaded (some problems with DB), throwing an exception
            $exception = new \OxidEsales\Eshop\Core\Exception\DatabaseException(
                "Unable to load shop config values from database",
                0,
                new \Exception()
            );
            throw $exception;
        }

        // loading theme config options
        $this->_loadVarsFromDb($shopID, null, Config::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme'));

        // checking if custom theme (which has defined parent theme) config options should be loaded over parent theme (#3362)
        if ($this->getConfigParam('sCustomTheme')) {
            $this->_loadVarsFromDb($shopID, null, Config::OXMODULE_THEME_PREFIX . $this->getConfigParam('sCustomTheme'));
        }

        // loading modules config
        $this->_loadVarsFromDb($shopID, null, Config::OXMODULE_MODULE_PREFIX);

        $this->loadAdditionalConfiguration();

        // Admin handling
        $this->setConfigParam('blAdmin', isAdmin());

        if (defined('OX_ADMIN_DIR')) {
            $this->setConfigParam('sAdminDir', OX_ADMIN_DIR);
        }

        $this->_loadVarsFromFile();
    }
1083463
protected function addModuleControllers($moduleControllers, $moduleId)
    {
        $this->validateModuleMetadataControllersOnActivation($moduleControllers);

        $classProviderStorage = $this->getClassProviderStorage();

        $classProviderStorage->add($moduleId, $moduleControllers);
    }
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;
    }
711181
protected function parseModuleSettings($moduleSettings)
    {
        $settings = [];

        if (is_array($moduleSettings)) {
            foreach ($moduleSettings as $setting) {
                $settings[] = $setting['name'];
            }
        }

        return $settings;
    }
407535
public void addModuleToExport(final String moduleName) {

        if (m_modulesToExport == null) {
            m_modulesToExport = new HashSet<String>();
        }
        m_modulesToExport.add(moduleName);
    }
15535
public function getShopConfVar($varName, $shopId = null, $module = '')
    {
        if (!$shopId) {
            $shopId = $this->getShopId();
        }

        if ($shopId == $this->getShopId() && (!$module || $module == Config::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme'))) {
            $varValue = $this->getConfigParam($varName);
            if ($varValue !== null) {
                return $varValue;
            }
        }

        $db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);

        $query = "select oxvartype, " . $this->getDecodeValueQuery() . " as oxvarvalue from oxconfig where oxshopid = '{$shopId}' and oxmodule = '{$module}' and oxvarname = " . $db->quote($varName);
        $rs = $db->select($query);

        if ($rs != false && $rs->count() > 0) {
            return $this->decodeValue($rs->fields['oxvartype'], $rs->fields['oxvarvalue']);
        }
    }
1032823
protected function _addModuleExtensions($moduleExtensions, $moduleId)
    {
        $extensions = (array) $this->getConfig()->getConfigParam('aModuleExtensions');
        $old = isset($extensions[$moduleId]) ? $extensions[$moduleId] : null;
        $old = (array) $old;
        $new = $moduleExtensions === null ? [] : array_values($moduleExtensions);
        if (is_array($moduleExtensions)) {
            $diff = $this->diff($old, $new);
            if ($diff) {
                $extensions[$moduleId] = array_values($moduleExtensions);
                $this->output->writeLn("$moduleId fixing module extensions:" . $old === null ? ' everything ' : var_export($diff, true));
                $this->_saveToConfig('aModuleExtensions', $extensions);
                $this->needCacheClear = true;
            }
        } else {
            $this->output->writeLn("$moduleId unregister module extensions");
            $this->needCacheClear = true;
            $this->_saveToConfig('aModuleExtensions', []);
        }
    }
1070683
public function add($moduleId, $controllers)
    {
        $controllerMap = $this->get();
        $controllerMap[$moduleId] = $controllers;

        $this->set($controllerMap);
    }
518079
public function save(ShopModuleSetting $shopModuleSetting)
    {
        $this->transactionService->begin();

        try {
            /**
             * The same entity was splitted between two tables.
             * Till we can't refactor tables we have to save data in both.
             */
            $this->deleteFromOxConfigTable($shopModuleSetting);
            $this->deleteFromOxConfigDisplayTable($shopModuleSetting);

            $this->saveDataToOxConfigTable($shopModuleSetting);
            $this->saveDataToOxConfigDisplayTable($shopModuleSetting);

            $this->transactionService->commit();
        } catch (\Throwable $throwable) {
            $this->transactionService->rollback();
            throw $throwable;
        }
    }
758094
public function installModule($modulePath)
    {
        $module = $this->loadModule($modulePath);

        $moduleCache = new ModuleCache($module);
        $moduleInstaller = new ModuleInstaller($moduleCache);

        /** Clean all caches before module activation */
        $this->clearShopTmpFolder();

        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getInstance();
        $database->flushTableDescriptionCache();

        $cachedClassInstances = Registry::getKeys();

        if (!$moduleInstaller->activate($module)) {
            throw new Exception("Error on module installation: " . $module->getId());
        }

        foreach ($cachedClassInstances as $cachedClassInstance) {
            if (\OxidEsales\Eshop\Core\ConfigFile::class !== $cachedClassInstance) {
                Registry::set($cachedClassInstance, null);
            }
        }
        $baseClass = new \OxidEsales\Eshop\Core\Base();
        $baseClass->setSession(null);
        $baseClass->setUser(null);
        $baseClass->setAdminMode(null);

        if (method_exists($baseClass, 'setRights')) {
            $baseClass->setRights(null);
        }

        $this->clearShopTmpFolder();
    }
178106
public function getModuleSettings($module_id, $key = null, $default = null)
    {
        return $this->module->getSettings($module_id, $key, $default);
    }
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);
    }
156243
protected function _addModuleExtensions($moduleExtensions, $moduleId)
    {
        $extensions = (array) \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aModuleExtensions');
        if (is_array($extensions)) {
            $extensions[$moduleId] = array_values($moduleExtensions);
        }

        $this->_saveToConfig('aModuleExtensions', $extensions);
    }
332291
public void promoteModule(final String moduleId) {
        final DbModule module = getModule(moduleId);

        for (final String gavc : DataUtils.getAllArtifacts(module)) {
            final DbArtifact artifact = repositoryHandler.getArtifact(gavc);
            artifact.setPromoted(true);
            repositoryHandler.store(artifact);
        }

        repositoryHandler.promoteModule(module);
    }
102829
public static function get_blockids_from_moduleid($moduleid) {
        global $DB;

        // Get the context of the module
        $contextid = context_module::instance($moduleid)->id;

        // Get all the block instances which parentcontextid is the module contextid
        $blockids = array();
        $instances = $DB->get_records('block_instances', array('parentcontextid' => $contextid), '', 'id');
        foreach ($instances as $instance) {
            $blockids[] = $instance->id;
        }
        return $blockids;
    }