function __construct($name, $path, $mainInstaller) { parent::__construct($name, $path, $mainInstaller); if ($mainInstaller) { $ini = $mainInstaller->installerIni; $contexts = $ini->getValue($this->name . '.contexts', '__modules_data'); if ($contexts !== null && $contexts !== "") { $this->installerContexts = explode(',', $contexts); } } }
/** * check dependencies of a module * @param jInstallerComponentBase $component * @param string $epId */ protected function _checkDependencies($component, $epId) { if (isset($this->_checkedCircularDependency[$component->getName()])) { $component->inError = self::INSTALL_ERROR_CIRCULAR_DEPENDENCY; throw new jInstallerException('module.circular.dependency', $component->getName()); } //$this->ok('install.module.check.dependency', $component->getName()); $this->_checkedCircularDependency[$component->getName()] = true; $compNeeded = ''; foreach ($component->dependencies as $compInfo) { // TODO : supports others type of components if ($compInfo['type'] != 'module') { continue; } $name = $compInfo['name']; $comp = null; if (isset($this->modules[$epId][$name])) { $comp = $this->modules[$epId][$name]; } if (!$comp) { $compNeeded .= $name . ', '; } else { if (!isset($this->_checkedComponents[$comp->getName()])) { $comp->init(); } if (!$comp->checkVersion($compInfo['minversion'], $compInfo['maxversion'])) { if ($name == 'jelix') { $args = $component->getJelixVersion(); array_unshift($args, $component->getName()); throw new jInstallerException('module.bad.jelix.version', $args); } else { throw new jInstallerException('module.bad.dependency.version', array($component->getName(), $comp->getName(), $compInfo['minversion'], $compInfo['maxversion'])); } } if (!isset($this->_checkedComponents[$comp->getName()])) { $this->_checkDependencies($comp, $epId); if ($this->entryPoints[$epId]->config->disableInstallers || !$comp->isInstalled($epId)) { $this->_componentsToInstall[] = array($comp, true); } else { if (!$comp->isUpgraded($epId)) { $this->_componentsToInstall[] = array($comp, false); } } } } } $this->_checkedComponents[$component->getName()] = true; unset($this->_checkedCircularDependency[$component->getName()]); if ($compNeeded) { $component->inError = self::INSTALL_ERROR_MISSING_DEPENDENCIES; throw new jInstallerException('module.needed', array($component->getName(), $compNeeded)); } }