Returns the install infos of all installed modules.
public getInstallInfos ( ) : Puli\Manager\Api\Module\InstallInfo[] | ||
return | Puli\Manager\Api\Module\InstallInfo[] | The install infos. |
/** * Loads all modules referenced by the install file. * * @throws FileNotFoundException If the install path of a module not exist. * @throws NoDirectoryException If the install path of a module points to a * file. * @throws InvalidConfigException If a module is not configured correctly. * @throws NameConflictException If a module has the same name as another * loaded module. */ private function loadModules() { $this->modules = new ModuleList(); $this->modules->add(new RootModule($this->rootModuleFile, $this->rootDir)); foreach ($this->rootModuleFile->getInstallInfos() as $installInfo) { $this->modules->add($this->loadModule($installInfo)); } }
/** * Loads all modules referenced by the install file. * * @throws FileNotFoundException If the install path of a module not exist. * @throws NoDirectoryException If the install path of a module points to a * file. * @throws InvalidConfigException If a module is not configured correctly. * @throws NameConflictException If a module has the same name as another * loaded module. */ private function loadModules() { $this->modules = new ModuleCollection(); $this->modules->add(new RootModule($this->rootModuleFile, $this->rootDir)); foreach ($this->rootModuleFile->getInstallInfos() as $installInfo) { // Catch and log exceptions so that single modules cannot break // the whole repository $this->modules->add($this->loadModule($installInfo)); } }
protected function addRootModuleFileToJson(RootModuleFile $moduleFile, stdClass $jsonData) { $moduleOrder = $moduleFile->getModuleOrder(); $installInfos = $moduleFile->getInstallInfos(); // Pass false to exclude base configuration values $configValues = $moduleFile->getConfig()->toRawArray(false); if (count($moduleOrder) > 0) { $jsonData->order = $moduleOrder; } if (count($configValues) > 0) { $jsonData->config = (object) $configValues; } if (array() !== $moduleFile->getPluginClasses()) { $jsonData->plugins = $moduleFile->getPluginClasses(); sort($jsonData->plugins); } if (count($installInfos) > 0) { $modulesData = array(); foreach ($installInfos as $installInfo) { $installData = new stdClass(); $installData->{'install-path'} = $installInfo->getInstallPath(); if (InstallInfo::DEFAULT_INSTALLER_NAME !== $installInfo->getInstallerName()) { $installData->installer = $installInfo->getInstallerName(); } if ($installInfo->hasDisabledBindingUuids()) { $installData->{'disabled-bindings'} = array(); foreach ($installInfo->getDisabledBindingUuids() as $uuid) { $installData->{'disabled-bindings'}[] = $uuid->toString(); } sort($installData->{'disabled-bindings'}); } if (Environment::PROD !== $installInfo->getEnvironment()) { $installData->env = $installInfo->getEnvironment(); } $modulesData[$installInfo->getModuleName()] = $installData; } ksort($modulesData); $jsonData->modules = (object) $modulesData; } }
/** * {@inheritdoc} */ public function removeObsoleteDisabledBindingDescriptors() { $this->assertModulesLoaded(); $removedUuidsByModule = array(); try { foreach ($this->rootModuleFile->getInstallInfos() as $installInfo) { foreach ($installInfo->getDisabledBindingUuids() as $uuid) { if (!$this->bindingDescriptors->contains($uuid)) { $installInfo->removeDisabledBindingUuid($uuid); $removedUuidsByModule[$installInfo->getModuleName()][] = $uuid; } } } $this->saveRootModuleFile(); } catch (Exception $e) { foreach ($removedUuidsByModule as $moduleName => $removedUuids) { $installInfo = $this->rootModuleFile->getInstallInfo($moduleName); foreach ($removedUuids as $uuid) { $installInfo->addDisabledBindingUuid($uuid); } } throw $e; } }