Esempio n. 1
0
 private function refreshState()
 {
     if (null === $this->typeDescriptor || !$this->typeDescriptor->isLoaded()) {
         $this->state = BindingState::TYPE_NOT_FOUND;
     } elseif (!$this->typeDescriptor->isEnabled()) {
         $this->state = BindingState::TYPE_NOT_ENABLED;
     } elseif (count($this->loadErrors) > 0) {
         $this->state = BindingState::INVALID;
     } elseif ($this->containingModule instanceof RootModule) {
         $this->state = BindingState::ENABLED;
     } elseif ($this->containingModule->getInstallInfo()->hasDisabledBindingUuid($this->binding->getUuid())) {
         $this->state = BindingState::DISABLED;
     } else {
         $this->state = BindingState::ENABLED;
     }
 }
Esempio n. 2
0
 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()));
 }