protected readEntryPointsData ( Jelix\Core\Infos\AppInfos $appInfos ) | ||
$appInfos | Jelix\Core\Infos\AppInfos |
protected function readEntryPointsData(\Jelix\Core\Infos\AppInfos $appInfos)
{
$configFileList = array();
$installerIni = $this->installerIni;
$allModules =& $this->allModules;
$that = $this;
// read all entry points data
foreach ($appInfos->entrypoints as $file => $entrypoint) {
$configFile = $entrypoint['config'];
if (isset($entrypoint['type'])) {
$type = $entrypoint['type'];
} else {
$type = "classic";
}
// we create an object corresponding to the entry point
$ep = $this->getEntryPointObject($configFile, $file, $type);
$epId = $ep->getEpId();
$ep->setUrlMap($this->xmlMapFile->addEntryPoint($epId, $type));
$ep->setAppInfos($appInfos);
$this->epId[$file] = $epId;
$this->entryPoints[$epId] = $ep;
// ignore entry point which have the same config file of an other one
if (isset($configFileList[$configFile])) {
$ep->sameConfigAs = $configFileList[$configFile];
continue;
}
$configFileList[$configFile] = $epId;
$ep->createInstallLaunchers(function ($moduleStatus, $moduleInfos) use($that, $epId) {
$name = $moduleInfos->name;
$path = $moduleInfos->getPath();
$that->installerIni->setValue($name . '.installed', $moduleStatus->isInstalled, $epId);
$that->installerIni->setValue($name . '.version', $moduleStatus->version, $epId);
if (!isset($that->allModules[$path])) {
$that->allModules[$path] = new ModuleInstallLauncher($moduleInfos, $that);
}
return $that->allModules[$path];
});
// remove informations about modules that don't exist anymore
$modulesList = $ep->getModulesList();
$modules = $this->installerIni->getValues($epId);
foreach ($modules as $key => $value) {
$l = explode('.', $key);
if (count($l) <= 1) {
continue;
}
if (!isset($modulesList[$l[0]])) {
$this->installerIni->removeValue($key, $epId);
}
}
}
}