/**
* check dependencies of given modules and plugins
*
* @param AbstractInstallLauncher[] $list
* @param Installer $installer to report error
* @return false|array list of arrays: 0:ModuleInstallLauncher 1: true to install, false to update
*/
public function getOrderedDependencies($list, $installer = null)
{
$this->_checkedComponents = array();
$this->_componentsToInstall = array();
$result = true;
$epId = $this->getEpId();
foreach ($list as $component) {
$this->_checkedCircularDependency = array();
if (!isset($this->_checkedComponents[$component->getName()])) {
try {
$this->_checkDependencies($component);
if ($this->config->disableInstallers || !$component->isInstalled($epId)) {
$this->_componentsToInstall[] = array($component, true);
} else {
if (!$component->isUpgraded($epId)) {
$this->_componentsToInstall[] = array($component, false);
}
}
} catch (\Jelix\Installer\Exception $e) {
$result = false;
if ($installer) {
$installer->error($e->getLocaleKey(), $e->getLocaleParameters());
} else {
throw $e;
}
} catch (\Exception $e) {
$result = false;
if ($installer) {
$installer->error($e->getMessage() . " comp=" . $component->getName(), null, true);
} else {
throw $e;
}
}
}
}
if ($result) {
return $this->_componentsToInstall;
}
return false;
}