Prepare module info
@param string $module_id
@param array $info
@param array $installed
@return array
160293
protected function prepareInfo($module_id, array $info, array $installed)
    {
        $info['directory'] = $this->getDirectory($module_id);

        $info += array(
            'type' => 'module',
            'name' => $module_id,
            'version' => null
        );

        // Do not override status set in module.json for locked modules
        if (isset($info['status']) && !empty($info['lock'])) {
            unset($installed[$module_id]['status']);
        }

        if ($info['version'] === 'core') {
            $info['version'] = GC_VERSION;
        }

        if (!empty($info['dependencies'])) {
            foreach ((array) $info['dependencies'] as $dependency_module_id => $dependency_version) {
                if ($dependency_version === 'core') {
                    $info['dependencies'][$dependency_module_id] = GC_VERSION;
                }
            }
        }

        // Do not override weight set in module.json for locked modules
        if (isset($info['weight']) && !empty($info['lock'])) {
            unset($installed[$module_id]['weight']);
        }

        if (isset($installed[$module_id])) {

            $info['installed'] = true;

            if (empty($installed[$module_id]['settings'])) {
                unset($installed[$module_id]['settings']);
            }

            $info = array_replace($info, $installed[$module_id]);
        }

        if (!empty($info['status'])) {

            try {
                $instance = $this->getInstance($module_id);
                $info['hooks'] = $this->getHooks($instance);
                $info['class'] = get_class($instance);
            } catch (Exception $exc) {
                return $info;
            }
        }

        return $info;
    }
987845
protected function getModuleInformation(Repository $repository, $module)
    {
        return [
            '#'           => $module['order'],
            'location'    => $repository->location,
            'name'        => isset($module['name']) ? $module['name'] : '',
            'slug'        => $module['slug'],
            'description' => isset($module['description']) ? $module['description'] : '',
            'status'      => (modules($repository->location)->isEnabled($module['slug'])) ? 'Enabled' : 'Disabled',
        ];
    }
178106
public function getModuleSettings($module_id, $key = null, $default = null)
    {
        return $this->module->getSettings($module_id, $key, $default);
    }
363795
protected function _prepareArrayModule(array &$module, &$moduleObject = false)
    {
        $moduleName = key($module);
        $module     = $module[$moduleName];

        if (is_object($module))
            $moduleObject = $module;
        
        # we want to register module name on event only if instance object resolved
        $module = $moduleName;
    }
82768
protected function makeModuleInstance(ModelInformationInterface $information)
    {
        $modelClass = $information->modelClass();

        $module = new ModelModule(
            app(ModelInformationRepositoryInterface::class),
            $this->moduleHelper,
            app(RouteHelperInterface::class),
            $this->makeModuleKey($modelClass),
            $this->makeModuleName($modelClass)
        );

        $module->setAssociatedClass($modelClass);

        if ($information->meta->controller) {
            $module->setWebController($information->meta->controller);
        }

        if ($information->meta->controller_api) {
            $module->setApiController($information->meta->controller_api);
        }

        return $module;
    }
80980
public function canInstall($module_id)
    {
        if ($this->module->isInstalled($module_id)) {
            throw new UnexpectedValueException($this->translation->text('Module already installed'));
        }

        if ($this->module->isLocked($module_id)) {
            throw new UnexpectedValueException($this->translation->text('Module is locked in code'));
        }

        if ($this->module->isInstaller($module_id)) {
            $error = $this->translation->text('Modules with "installer" type cannot be installed/enabled when system is already set up');
            throw new UnexpectedValueException($error);
        }

        $this->module->getInstance($module_id); // Test module class
        return $this->checkRequirements($module_id);
    }
1374190
private function printModulesWithFormat(IO $io, ModuleList $modules, $format)
    {
        /** @var Module $module */
        foreach ($modules as $module) {
            $installInfo = $module->getInstallInfo();

            $io->writeLine(strtr($format, array(
                '%name%' => $module->getName(),
                '%installer%' => $installInfo ? $installInfo->getInstallerName() : '',
                '%install_path%' => $module->getInstallPath(),
                '%state%' => self::$stateStrings[$module->getState()],
                '%env%' => $installInfo ? $installInfo->getEnvironment() : Environment::PROD,
            )));
        }
    }
364205
public function canUninstall($module_id)
    {
        if ($this->module->isActiveTheme($module_id)) {
            $error = $this->translation->text('Modules with "theme" type and active status cannot be disabled/uninstalled');
            throw new UnexpectedValueException($error);
        }

        if ($this->module->isLocked($module_id)) {
            throw new UnexpectedValueException($this->translation->text('Module is locked in code'));
        }

        return $this->checkDependentModules($module_id, $this->module->getList());
    }
478897
protected function checkDependenciesModule($module_id)
    {
        $modules = $this->module->getList();
        $validated = $this->validateDependencies($modules, true);

        if (empty($validated[$module_id]['errors'])) {
            return true;
        }

        $messages = array();
        foreach ($validated[$module_id]['errors'] as $error) {
            list($text, $arguments) = $error;
            $messages[] = $this->translation->text($text, $arguments);
        }

        throw new UnexpectedValueException(implode('<br>', $messages));
    }
673604
protected function prepareListItem(array &$libraries, $library_id, array &$library)
    {
        if (empty($library['type'])) {
            unset($libraries[$library_id]);
            return null;
        }

        $types = $this->getTypes();

        if (empty($types[$library['type']])) {
            unset($libraries[$library_id]);
            return null;
        }

        $library['id'] = $library_id;

        if (!isset($library['basepath'])) {
            if (isset($library['vendor'])) {
                $library['vendor'] = strtolower($library['vendor']);
                $library['basepath'] = GC_DIR_VENDOR . "/{$library['vendor']}";
            } else if (isset($types[$library['type']]['basepath'])) {
                $library['basepath'] = "{$types[$library['type']]['basepath']}/$library_id";
            } else {
                unset($libraries[$library_id]);
                return null;
            }
        }

        if ($library['type'] === 'php' && empty($library['files']) && !empty($library['vendor'])) {
            $library['files'] = array(GC_FILE_AUTOLOAD);
        }

        if (!isset($library['version'])) {
            $library['errors'][] = array('Unknown version', array());
        }

        if (!$this->validateFiles($library)) {
            $library['errors'][] = array('Missing files', array());
        }

        return null;
    }
707364
function info($plugin_name)
	{
		if(isset($this->plugins[$plugin_name])) return $this->plugins[$plugin_name];
		return false;
	}
735171
private static function get_all_licenses( $module_id = null ) {
            $licenses = self::get_account_option( 'all_licenses' );

            if ( ! is_array( $licenses ) ) {
                $licenses = array();
            }

            if ( is_null( $module_id ) ) {
                return $licenses;
            }

            $licenses = isset( $licenses[ $module_id ] ) ?
                $licenses[ $module_id ] :
                array();

            return $licenses;
        }
177944
protected function setModuleControllers($moduleControllers, $moduleId, $module)
    {

        if ($module->isActive()) {
            $classProviderStorage = $this->getClassProviderStorage();
            $dbMap = $classProviderStorage->get();
            $controllersForThatModuleInDb = isset($dbMap[$moduleId]) ? $dbMap[$moduleId] : [];
            $duplicatedKeys = array_intersect_key(
                array_change_key_case($moduleControllers, CASE_LOWER), $controllersForThatModuleInDb
            );
            if (array_diff_assoc($moduleControllers, $duplicatedKeys)) {
                $this->output->writeLn("$moduleId fix module ModuleControllers");
                $this->deleteModuleControllers($moduleId);
                $this->resetModuleCache($module);
                $this->validateModuleMetadataControllersOnActivation($moduleControllers);

                $classProviderStorage = $this->getClassProviderStorage();

                $classProviderStorage->add($moduleId, $moduleControllers);
                $this->needCacheClear = true;
            }
        } else {
            $moduleCache = oxNew( \OxidEsales\Eshop\Core\Module\ModuleCache::class, $module);
            $moduleInstaller = oxNew(\OxidEsales\Eshop\Core\Module\ModuleInstaller::class, $moduleCache);
            $moduleInstaller->deactivate($module);}
    }
584184
function get_install_by_blog_id( $blog_id = null ) {
            $installs = self::get_all_sites( $this->_module_type, $blog_id );
            $install  = isset( $installs[ $this->_slug ] ) ? $installs[ $this->_slug ] : null;

            if ( is_object( $install ) &&
                 is_numeric( $install->id ) &&
                 is_numeric( $install->user_id ) &&
                 FS_Plugin_Plan::is_valid_id( $install->plan_id )
            ) {
                // Load site.
                $install = clone $install;
            }

            return $install;
        }
849410
public function installModule($plugin_id)
	{
		$moduleVendorPath = Yii::getPathOfAlias('application.vendor.ommu');
		$module = OmmuPlugins::model()->findByPk($plugin_id);

		if($module != null) {
			$moduleName = $module->folder;
			if($model->parent_id != 0)
				$moduleName = $module->parent->folder;
			
			if($model->install == 1) {
				$config = $this->getModuleConfig($moduleName);
				if($config) {
					$tableName = $config['db_table_name'];
					$fileName  = trim($config['db_sql_filename']);
					$sqlFile = $moduleVendorPath.'/'.$moduleName.'/data/'.$fileName;
	
					if($tableName && !empty($tableName) && $fileName != '' && file_exists($sqlFile)) {
						$tables  = Yii::app()->db->createCommand('SHOW FULL TABLES WHERE table_type = "BASE TABLE"')->queryColumn();
	
						if(!in_array($tableName[0], $tables)) {
							$sql = file_get_contents($sqlFile);
							Yii::app()->db->createCommand($sql)->execute();
						}
					}
				}

			} else
				$this->deleteModuleDatabase($moduleName);

		} else
			return false;
	}
221087
private function loadModule(InstallInfo $installInfo)
    {
        $installPath = Path::makeAbsolute($installInfo->getInstallPath(), $this->rootDir);
        $moduleFile = null;
        $loadError = null;

        // Catch and log exceptions so that single modules cannot break
        // the whole repository
        try {
            $moduleFile = $this->loadModuleFile($installPath);
        } catch (InvalidConfigException $loadError) {
        } catch (UnsupportedVersionException $loadError) {
        } catch (FileNotFoundException $loadError) {
        } catch (NoDirectoryException $loadError) {
        }

        $loadErrors = $loadError ? array($loadError) : array();

        return new Module($moduleFile, $installPath, $installInfo, $loadErrors);
    }
928937
private function _update_licenses( $licenses, $module_id ) {
            $this->_logger->entrance();

            if ( is_array( $licenses ) ) {
                for ( $i = 0, $len = count( $licenses ); $i < $len; $i ++ ) {
                    $licenses[ $i ]->updated = time();
                }
            }

            $this->_store_licenses( true, $module_id, $licenses );
        }