function _drush_backend_get_global_contexts

8.0.x backend.inc _drush_backend_get_global_contexts($site_record)
6.x backend.inc _drush_backend_get_global_contexts($site_record)
7.x backend.inc _drush_backend_get_global_contexts($site_record)
5.x backend.inc _drush_backend_get_global_contexts($site_record)
master backend.inc _drush_backend_get_global_contexts($site_record)

Find all of the drush contexts that are used to cache global values and return them in an associative array.

1 call to _drush_backend_get_global_contexts()
drush_backend_invoke_concurrent in includes/backend.inc
Execute a new local or remote command in a new process.

File

includes/backend.inc, line 861
Drush backend API

Code

function _drush_backend_get_global_contexts($site_record) {
  $result = array();
  $global_option_list = drush_get_global_options(FALSE);
  foreach ($global_option_list as $global_key => $global_metadata) {
    if (is_array($global_metadata)) {
      $value = '';
      if (!array_key_exists('never-propagate', $global_metadata)) {
        if ((array_key_exists('propagate', $global_metadata))) {
          $value = drush_get_option($global_key);
        }
        elseif ((array_key_exists('propagate-cli-value', $global_metadata))) {
          $value = drush_get_option($global_key, '', 'cli');
        }
        elseif ((array_key_exists('context', $global_metadata))) {
          // If the context is declared to be a 'local-context-only',
          // then only put it in if this is a local dispatch.
          if (!array_key_exists('local-context-only', $global_metadata) || !array_key_exists('remote-host', $site_record)) {
            $value = drush_get_context($global_metadata['context'], array());
          }
        }
        if (!empty($value) || ($value === '0')) {
          $result[$global_key] = $value;
        }
      }
    }
  }
  return $result;
}