/**
* get the object which is responsible to install the component. this
* object should implement AbstractInstaller.
*
* @param EntryPoint $ep the entry point
* @param boolean $installWholeApp true if the installation is done during app installation
* @return ModuleInstaller the installer, or null if there isn't any installer
* or false if the installer is useless for the given parameter
*/
function getInstaller(EntryPoint $ep, $installWholeApp)
{
$this->_setAccess($ep->getConfigIni());
// false means that there isn't an installer for the module
if ($this->moduleInstaller === false) {
return null;
}
$epId = $ep->getEpId();
if ($this->moduleInstaller === null) {
if (!file_exists($this->moduleInfos->getPath() . 'install/install.php') || $this->moduleStatuses[$epId]->skipInstaller) {
$this->moduleInstaller = false;
return null;
}
require_once $this->moduleInfos->getPath() . 'install/install.php';
$cname = $this->moduleInfos->name . 'ModuleInstaller';
if (!class_exists($cname)) {
throw new Exception("module.installer.class.not.found", array($cname, $this->name));
}
$this->moduleInstaller = new $cname($this->moduleInfos->name, $this->moduleInfos->name, $this->moduleInfos->getPath(), $this->moduleInfos->version, $installWholeApp);
}
$this->moduleInstaller->setParameters($this->moduleStatuses[$epId]->parameters);
if ($ep->getLocalConfigIni()) {
$sparam = $ep->getLocalConfigIni()->getValue($this->moduleInfos->name . '.installparam', 'modules');
} else {
$sparam = $ep->getConfigIni()->getValue($this->moduleInfos->name . '.installparam', 'modules');
}
if ($sparam === null) {
$sparam = '';
}
$sp = $this->moduleStatuses[$epId]->serializeParameters();
if ($sparam != $sp) {
$ep->getConfigIni()->setValue($this->moduleInfos->name . '.installparam', $sp, 'modules');
}
$this->moduleInstaller->setEntryPoint($ep, $this->moduleStatuses[$epId]->dbProfile, $this->installerContexts);
return $this->moduleInstaller;
}