示例#1
0
 /**
  * Internal function to discover what modules are required for the current
  * being proccessed configurations.
  *
  * @see iterate()
  */
 protected function discoverModules(ConfigIteratorSettings &$settings)
 {
     $modules = $settings->getInfo('modules');
     $modules = array_merge($modules, $this->getRequiredModules());
     $settings->setInfo('modules', $modules);
 }
 /**
  * Returns a list of modules required to import the configurations indicated
  * in $list.
  *
  * @param  array  $modules
  *   The list of modules that are listed in the tracked.inc file.
  */
 public static function discoverRequiredModules($modules)
 {
     $settings = new ConfigIteratorSettings(array('info' => array('modules' => array(), 'modules_missing' => array(), 'modules_to_install' => array())));
     $stack = array();
     foreach ($modules as $module) {
         Configuration::getDependentModules($module, $stack);
     }
     $missing = array();
     $to_install = array();
     foreach ($stack as $module_name => $status) {
         if ($status == Configuration::moduleMissing) {
             $missing[] = $module_name;
         } elseif ($status == Configuration::moduleToInstall) {
             $to_install[] = $module_name;
         }
     }
     $settings->setInfo('modules_to_install', array_filter(array_unique($to_install)));
     $settings->setInfo('modules_missing', array_filter(array_unique($missing)));
     return $settings;
 }