* @access public * @package tao * */ class tao_install_utils_ChecksHelper { /** * Get the ComponentCollection corresponding to the distribution. It * the configuration checks to perform for all extensions involved in the * * @access public * @author Jerome Bogaerts, * @param array $extensionIds * @return common_configuration_ComponentCollection */ public static function getConfigChecker($extensionIds) { $returnValue = new common_configuration_ComponentCollection(); $checkArray = []; // resolve dependencies foreach (self::getRawChecks($extensionIds) as $c) { $checkArray[] = $c; $comp = common_configuration_ComponentFactory::buildFromArray($c); if (!empty($c['value']['id'])) { $componentArray[$c['value']['id']] = $comp; } $returnValue->addComponent($comp); if (!empty($c['value']['silent']) && $c['value']['silent'] == true) { $returnValue->silent($comp); } } // Deal with the dependencies. foreach ($checkArray as $config) { if (!empty($config['value']['dependsOn']) && is_array($config['value']['dependsOn'])) { foreach ($config['value']['dependsOn'] as $d) { // Find the component it depends on and tell the ComponentCollection. if (!empty($componentArray[$config['value']['id']]) && !empty($componentArray[$d])) { $returnValue->addDependency($componentArray[$config['value']['id']], $componentArray[$d]); } } } } return $returnValue; } public static function getRawChecks($extensionIds) { $checks = []; // resolve dependencies $toCheck = []; while (!empty($extensionIds)) { $ext = array_pop($extensionIds); $manifestPath = dirname(__FILE__) . '/../../../' . $ext . '/manifest.php'; $dependencyIds = Manifest::extractDependencies($manifestPath); $extensionIds = array_unique(array_merge($extensionIds, array_diff($dependencyIds, $toCheck))); $toCheck[] = $ext; } // We extract the checks to perform from the manifests // depending on the distribution. $checkArray = []; // merge of all arrays describing checks in the manifests. $componentArray = []; // array of Component instances. array keys are the IDs. foreach ($toCheck as $ext) { $manifestPath = dirname(__FILE__) . '/../../../' . $ext . '/manifest.php'; $checks = array_merge($checks, Manifest::extractChecks($manifestPath)); } return $checks; } }