function drush_set_config_special_contexts

8.0.x context.inc drush_set_config_special_contexts(&$options)
6.x context.inc drush_set_config_special_contexts(&$options)
7.x context.inc drush_set_config_special_contexts(&$options)
3.x context.inc drush_set_config_special_contexts(&$options)
4.x context.inc drush_set_config_special_contexts(&$options)
5.x context.inc drush_set_config_special_contexts(&$options)
master context.inc drush_set_config_special_contexts(&$options)

There are certain options such as 'site-aliases' and 'command-specific' that must be merged together if defined in multiple drush configuration files. If we did not do this merge, then the last configuration file that defined any of these properties would overwrite all of the options that came before in previously-loaded configuration files. We place all of them into their own context so that this does not happen.

5 calls to drush_set_config_special_contexts()
drush_set_config_options in includes/context.inc
drush_sitealias_get_record in includes/sitealias.inc
Get a site alias record given an alias name or site specification.
drush_sitealias_load_all in includes/sitealias.inc
Load every alias file that can be found anywhere in the alias search path.
_drush_sitealias_find_and_load_alias in includes/sitealias.inc
Worker function called by _drush_sitealias_load_alias and drush_sitealias_load_all. Traverses the alias search path and finds the specified alias record.
_drush_sitealias_load_alias in includes/sitealias.inc
Check and see if an alias definition for $alias is available. If it is, load it into the list of aliases cached in the 'site-aliases' context.

File

includes/context.inc, line 222
The Drush context API implementation.

Code

function drush_set_config_special_contexts(&$options) {
  if (isset($options)) {
    $has_command_specific = array_key_exists('command-specific', $options);
    // Change the keys of the site aliases from 'alias' to '@alias'
    if (array_key_exists('site-aliases', $options)) {
      $user_aliases = $options['site-aliases'];
      $options['site-aliases'] = array();
      foreach ($user_aliases as $alias_name => $alias_value) {
        if (substr($alias_name, 0, 1) != '@') {
          $alias_name = "@$alias_name";
        }
        $options['site-aliases'][$alias_name] = $alias_value;
      }
    }

    // Copy site aliases and command-specific options into their
    // appropriate caches.
    $special_contexts = drush_get_special_keys();
    foreach ($special_contexts as $option_name) {
      if (isset($options[$option_name])) {
        $cache = &drush_get_context($option_name);
        $cache = array_merge($cache, $options[$option_name]);
        unset($options[$option_name]);
      }
    }
    // If command-specific options were set and if we already have
    // a command, then apply the command-specific options immediately.
    if ($has_command_specific) {
      drush_command_default_options();
    }
  }
}