Returns module extensions.

@param string $sModuleId

@return array
773603
public function getModuleExtensions($sModuleId)
    {
        if (!isset($this->_aModuleExtensions)) {
            $aModuleExtension = \OxidEsales\Eshop\Core\Registry::getConfig()->getModulesWithExtendedClass();
            $oModule = $this->getModule();
            $aExtension = [];
            foreach ($aModuleExtension as $sOxClass => $aFiles) {
                foreach ($aFiles as $sFilePath) {
                    $sId = $oModule->getIdByPath($sFilePath);
                    $aExtension[$sId][$sOxClass][] = $sFilePath;
                }
            }

            $this->_aModuleExtensions = $aExtension;
        }

        return $this->_aModuleExtensions[$sModuleId] ? $this->_aModuleExtensions[$sModuleId] : [];
    }
441422
public function isModuleActive($sModuleId, $sVersionFrom = null, $sVersionTo = null)
    {
        $blModuleIsActive = false;

        // use aModuleVersions instead of aModules, because aModules gives only modules which extend oxid classes
        $aModuleVersions = $this->getConfig()->getConfigParam('aModuleVersions');

        if (is_array($aModuleVersions)) {
            $blModuleIsActive = $this->_moduleExists($sModuleId, $aModuleVersions);

            if ($blModuleIsActive) {
                $blModuleIsActive = $this->_isModuleEnabled($sModuleId) && $this->_isModuleVersionCorrect($sModuleId, $sVersionFrom, $sVersionTo);
            }
        }

        return $blModuleIsActive;
    }
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', []);
        }
    }
1209455
public function getModuleFullPath(string $moduleId) : string
    {
        $modulePaths = Registry::getConfig()->getConfigParam('aModulePaths');

        /**
         * @TODO We have to throw an exception here in the future, module path should exist.
         *       Use module id for the BC.
         */
        $moduleRelativePath = $modulePaths[$moduleId] ?? $moduleId;

        return Registry::getConfig()->getModulesDir() . $moduleRelativePath;
    }
862438
public function get_extensions()
    {
        if ($this->exts)
            return $this->exts;

        if (!$this->sieve)
            return $this->_set_error(self::ERROR_INTERNAL);

        $ext = $this->sieve->getExtensions();

        if (is_a($ext, 'PEAR_Error')) {
            return array();
        }

        // we're working on lower-cased names
        $ext = array_map('strtolower', (array) $ext);

        if ($this->script) {
            $supported = $this->script->get_extensions();
            foreach ($ext as $idx => $ext_name)
                if (!in_array($ext_name, $supported))
                    unset($ext[$idx]);
        }

        return array_values($ext);
    }
811698
public static function drivers($sModule, $sSubType = ''): array
    {
        $aDrivers = static::filter('driver');
        $aOut     = [];

        foreach ($aDrivers as $oDriver) {
            if ($oDriver->forModule == $sModule) {
                if (!empty($sSubType) && $sSubType == $oDriver->subType) {
                    $aOut[] = $oDriver;
                } elseif (empty($sSubType)) {
                    $aOut[] = $oDriver;
                }
            }
        }

        return $aOut;
    }
146018
public function getDeletedExtensions()
    {
        $oModuleValidatorFactory = $this->getModuleValidatorFactory();
        $oModuleMetadataValidator = $oModuleValidatorFactory->getModuleMetadataValidator();
        $aModulesIds = $this->getModuleIds();
        $oModule = $this->getModule();
        $aDeletedExt = [];

        foreach ($aModulesIds as $sModuleId) {
            $oModule->setModuleData(['id' => $sModuleId]);
            if (!$oModuleMetadataValidator->validate($oModule)) {
                $aDeletedExt[$sModuleId]['files'] = [$sModuleId . '/metadata.php'];
            } else {
                $aInvalidExtensions = $this->_getInvalidExtensions($sModuleId);
                if ($aInvalidExtensions) {
                    $aDeletedExt[$sModuleId]['extensions'] = $aInvalidExtensions;
                }
            }
        }

        return $aDeletedExt;
    }
724766
public function extractModulePaths()
    {
        $aModules = $this->getModulesWithExtendedClass();
        $aModulePaths = [];

        if (is_array($aModules) && count($aModules) > 0) {
            foreach ($aModules as $aModuleClasses) {
                foreach ($aModuleClasses as $sModule) {
                    $sModuleId = substr($sModule, 0, strpos($sModule, "/"));
                    $aModulePaths[$sModuleId] = $sModuleId;
                }
            }
        }

        return $aModulePaths;
    }
223511
public static function extensions($zend = false)
    {
        if (!self::isDebug()) {
            return false;
        }
        return self::i()->dump(get_loaded_extensions($zend), '! extensions ' . ($zend ? '(Zend)' : '') . ' !');
    }
819646
protected function _getOxcomAdminSearchModules()
    {
        $aData = [];
        $oModules = oxNew(\OxidEsales\Eshop\Core\Module\ModuleList::class);
        $aModules = $oModules->getModulePaths();
        foreach ($aModules as $sKey => $sValue) {
            $oModule = oxNew(\OxidEsales\Eshop\Core\Module\Module::class);
            $oModule->load($sKey);
            $sTitle = strip_tags($oModule->getTitle());
            if (strstr(strtolower($sTitle), strtolower($this->_sQueryName))) {
                $aData[] = ['name' => $sTitle . ' (' . ($oModule->isActive() ? Registry::getLang()->translateString("OXCOM_ADMINSEARCH_MODULE_ACTIVE") : Registry::getLang()->translateString("OXCOM_ADMINSEARCH_MODULE_INACTIVE")) . ')', 'oxid' => $sKey, 'type' => 'module'];
            }
        }

        return $aData;
    }
1354398
public function getDisabledModuleClasses()
    {
        $disabledModules = $this->getDisabledModules();
        $disabledModuleClasses = [];
        if (isset($disabledModules) && is_array($disabledModules)) {
            //get all disabled module paths
            $extensions = $this->getModuleConfigParametersByKey(static::MODULE_KEY_EXTENSIONS);
            $modules = $this->getModulesWithExtendedClass();
            $modulePaths = $this->getModuleConfigParametersByKey(static::MODULE_KEY_PATHS);

            foreach ($disabledModules as $moduleId) {
                if (!array_key_exists($moduleId, $extensions)) {
                    $path = $modulePaths[$moduleId];
                    if (!isset($path)) {
                        $path = $moduleId;
                    }
                    foreach ($modules as $moduleClasses) {
                        foreach ($moduleClasses as $moduleClass) {
                            if (strpos($moduleClass, $path . "/") === 0) {
                                $disabledModuleClasses[] = $moduleClass;
                            }
                        }
                    }
                } else {
                    $disabledModuleClasses = array_merge($disabledModuleClasses, $extensions[$moduleId]);
                }
            }
        }

        return $disabledModuleClasses;
    }
15724
private function _getInvalidExtensions($moduleId)
    {
        $extendedShopClasses = $this->getModuleExtensions($moduleId);
        $invalidModuleClasses = [];

        foreach ($extendedShopClasses as $extendedShopClass => $moduleClasses) {
            foreach ($moduleClasses as $moduleClass) {
                if (\OxidEsales\Eshop\Core\NamespaceInformationProvider::isNamespacedClass($moduleClass)) {
                    /** @var \Composer\Autoload\ClassLoader $composerClassLoader */
                    $composerClassLoader = include VENDOR_PATH . 'autoload.php';
                    if (!$composerClassLoader->findFile($moduleClass)) {
                        $invalidModuleClasses[$extendedShopClass][] = $moduleClass;
                    }
                } else {
                    /** Note: $aDeletedExt is passed by reference */
                    $this->backwardsCompatibleGetInvalidExtensions($moduleClass, $invalidModuleClasses, $extendedShopClass);
                }
            }
        }

        return $invalidModuleClasses;
    }
572896
public List<String> getUptodateModules() {

        if (m_uptodateModules == null) {
            m_uptodateModules = new ArrayList<String>();
            m_modulesToUpdate = new ArrayList<String>();
            Map<String, CmsModuleVersion> installedModules = getInstalledModules();
            Map<String, CmsModule> availableModules = getAvailableModules();
            Iterator<Map.Entry<String, CmsModule>> itMods = availableModules.entrySet().iterator();
            while (itMods.hasNext()) {
                Map.Entry<String, CmsModule> entry = itMods.next();
                String name = entry.getKey();
                CmsModuleVersion instVer = installedModules.get(name);
                CmsModuleVersion availVer = entry.getValue().getVersion();
                boolean uptodate = (!UPDATE_ALL_MODULES) && ((instVer != null) && (instVer.compareTo(availVer) >= 0));
                if (uptodate) {
                    m_uptodateModules.add(name);
                } else {
                    m_modulesToUpdate.add(name);
                }
                if (LOG.isDebugEnabled()) {
                    LOG.debug(
                        name + " --- installed: " + instVer + " available: " + availVer + " --- uptodate: " + uptodate);
                }
            }
        }
        return m_uptodateModules;
    }
150058
protected function extractModuleIds($config)
    {
        $ids = [];

        foreach ($config as $index => $module) {
            if ($module['inactive']) {
                continue;
            }
            $ids[$index] = intval($module['module']);
        }

        return $ids;
    }
431405
protected function _addModuleEvents($aModuleEvents, $sModuleId)
    {
        $aEvents = (array) $this->getConfig()->getConfigParam('aModuleEvents');
        $old =  isset($aEvents[$sModuleId]) ? $aEvents[$sModuleId] : null;
        if (is_array($aModuleEvents) && count($aModuleEvents)) {
            $diff = $this->diff($old,$aModuleEvents);
            if ($diff) {
                $aEvents[$sModuleId] = $aModuleEvents;
                $this->output->writeLn("$sModuleId fixing module events:" . $old == null ? ' everything ' : var_export($diff, true));
                $this->_saveToConfig('aModuleEvents', $aEvents);
                $this->needCacheClear = true;
            }
        } else {
            if ($old) {
                $this->output->writeLn("$sModuleId unregister events");
                $this->_deleteModuleEvents($sModuleId);
                $this->needCacheClear = true;
            }
        }

    }
345835
public static function getModules($extensionId)
    {
        $returnValue = array();
        foreach (ControllerHelper::getControllers($extensionId) as $controllerClassName) {
            $shortName = strpos($controllerClassName, '\\') !== false
                ? substr($controllerClassName, strrpos($controllerClassName, '\\')+1)
                : substr($controllerClassName, strrpos($controllerClassName, '_')+1)
            ;
            $uri = AccessService::singleton()->makeEMAUri($extensionId, $shortName);
            $returnValue[$uri] = new \core_kernel_classes_Resource($uri);
        }
        return (array) $returnValue;
    }
726057
protected function filterExtensionsByModuleId($modules, $moduleId)
    {
        $modulePaths = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aModulePaths');

        $path = '';
        if (isset($modulePaths[$moduleId])) {
            $path = $modulePaths[$moduleId] . '/';
        }

        // TODO: This condition should be removed. Need to check integration tests.
        if (!$path) {
            $path = $moduleId . "/";
        }

        $filteredModules = [];
        foreach ($modules as $class => $extend) {
            foreach ($extend as $extendPath) {
                if (strpos($extendPath, $path) === 0) {
                    $filteredModules[$class][] = $extendPath;
                }
            }
        }

        return $filteredModules;
    }