Example #1
0
 private function makeAbsolute($relativePath, Module $containingModule, ModuleCollection $modules)
 {
     // Reference to install path of other module
     if ('@' !== $relativePath[0] || false === ($pos = strpos($relativePath, ':'))) {
         return $containingModule->getInstallPath() . '/' . $relativePath;
     }
     $refModuleName = substr($relativePath, 1, $pos - 1);
     if (!$modules->contains($refModuleName)) {
         throw new NoSuchModuleException(sprintf('The module "%s" referenced in the resource path "%s" was not ' . 'found. Maybe the module is not installed?', $refModuleName, $relativePath));
     }
     $refModule = $modules->get($refModuleName);
     return $refModule->getInstallPath() . '/' . substr($relativePath, $pos + 1);
 }
Example #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()));
 }