/** * {@inheritdoc} */ public function execute() { if (!$this->installInfo->hasDisabledBindingUuid($this->uuid)) { $this->wasDisabled = false; $this->installInfo->addDisabledBindingUuid($this->uuid); } }
private function renameNonRootModule(Module $module, $newName) { $previousInstallInfo = $module->getInstallInfo(); $installInfo = new InstallInfo($newName, $previousInstallInfo->getInstallPath()); $installInfo->setInstallerName($previousInstallInfo->getInstallerName()); foreach ($previousInstallInfo->getDisabledBindingUuids() as $uuid) { $installInfo->addDisabledBindingUuid($uuid); } $this->rootModuleFile->removeInstallInfo($module->getName()); $this->rootModuleFile->addInstallInfo($installInfo); try { $this->moduleFileStorage->saveRootModuleFile($this->rootModuleFile); } catch (Exception $e) { $this->rootModuleFile->removeInstallInfo($newName); $this->rootModuleFile->addInstallInfo($previousInstallInfo); throw $e; } $this->modules->remove($module->getName()); $this->modules->add(new Module($module->getModuleFile(), $module->getInstallPath(), $installInfo, $module->getLoadErrors())); }
protected function addJsonToRootModuleFile(stdClass $jsonData, RootModuleFile $moduleFile) { if (isset($jsonData->order)) { $moduleFile->setModuleOrder((array) $jsonData->order); } if (isset($jsonData->plugins)) { $moduleFile->setPluginClasses($jsonData->plugins); } if (isset($jsonData->config)) { $config = $moduleFile->getConfig(); foreach ($this->objectsToArrays($jsonData->config) as $key => $value) { $config->set($key, $value); } } if (isset($jsonData->modules)) { foreach ($jsonData->modules as $moduleName => $moduleData) { $installInfo = new InstallInfo($moduleName, $moduleData->{'install-path'}); if (isset($moduleData->env)) { $installInfo->setEnvironment($moduleData->env); } if (isset($moduleData->installer)) { $installInfo->setInstallerName($moduleData->installer); } if (isset($moduleData->{'disabled-bindings'})) { foreach ($moduleData->{'disabled-bindings'} as $uuid) { $installInfo->addDisabledBindingUuid(Uuid::fromString($uuid)); } } $moduleFile->addInstallInfo($installInfo); } } }
/** * {@inheritdoc} */ public function rollback() { if ($this->wasDisabled) { $this->installInfo->addDisabledBindingUuid($this->uuid); } }