function _drush_config_file

8.0.x context.inc _drush_config_file($context, $prefix = NULL, $version = '')
6.x context.inc _drush_config_file($context, $prefix = NULL, $version = '')
7.x context.inc _drush_config_file($context, $prefix = NULL, $version = '')
3.x context.inc _drush_config_file($context)
4.x context.inc _drush_config_file($context, $prefix = NULL, $version = '')
5.x context.inc _drush_config_file($context, $prefix = NULL, $version = '')
master context.inc _drush_config_file($context, $prefix = NULL, $version = '')

Return a list of possible drushrc file locations.

Return value

An associative array containing possible config files to load The keys are the 'context' of the files, the values are the file system locations.

2 calls to _drush_config_file()
drush_load_config in includes/context.inc
Load drushrc files (if available) from several possible locations.
drush_save_config in includes/context.inc
Save the settings in a specific context to the applicable configuration file This is useful is you want certain settings to be available automatically the next time a command is executed.

File

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

Code

function _drush_config_file($context) {
  $configs = array();

  // Did the user explicitly specify a config file?
  if ($config = drush_get_option(array('c', 'config'))) {
    if (is_dir($config)) {
      $config = $config . '/drushrc.php';
    }
    $configs['custom'] = $config;
  }

  if ($site_path = drush_get_context('DRUSH_DRUPAL_SITE_ROOT')) {
    $configs['site'] = $site_path . "/drushrc.php";
  }

  if ($drupal_root = drush_get_context('DRUSH_DRUPAL_ROOT')) {
    $configs['drupal'] = $drupal_root . '/drushrc.php';
  }

  // in the user home directory
  if (!is_null(drush_server_home())) {
    $configs['user'] = drush_server_home() . '/.drushrc.php';
  }

  // in $HOME/.drush directory
  if (!is_null(drush_server_home())) {
    $configs['home.drush'] = drush_server_home() . '/.drush/drushrc.php';
  }

  // In the system wide configuration folder.
  $configs['system'] = drush_get_context('ETC_PREFIX', '') . '/etc/drush/drushrc.php';

  // in the drush installation folder
  $configs['drush'] = dirname(__FILE__) . '/../drushrc.php';

  return empty($configs[$context]) ? '' : $configs[$context];
}