function _drush_core_directory

8.0.x core.drush.inc _drush_core_directory($target = 'root', $component = 'path', $local_only = FALSE)
6.x core.drush.inc _drush_core_directory($target = 'root', $component = 'path', $local_only = FALSE)
7.x core.drush.inc _drush_core_directory($target = 'root', $component = 'path', $local_only = FALSE)
3.x core.drush.inc _drush_core_directory($target = 'root')
4.x core.drush.inc _drush_core_directory($target = 'root', $component = 'path', $local_only = FALSE)
5.x core.drush.inc _drush_core_directory($target = 'root', $component = 'path', $local_only = FALSE)
master core.drush.inc _drush_core_directory($target = 'root', $component = 'path', $local_only = FALSE)

Given a target (e.g. @site:%modules), return the evaluated directory path

Parameters

$target: The target to evaluate. Can be @site or /path or @site:path or @site:%pathalais, etc. (just like rsync parameters)

$component: The portion of the evaluated path to return. Possible values: 'path' - the full path to the target (default) 'name' - the name of the site from the path (e.g. @site1) 'user-path' - the part after the ':' (e.g. %modules) 'root' & 'uri' - the Drupal root and URI of the site from the path 'path-component' - The ':' and the path

1 call to _drush_core_directory()

File

commands/core/core.drush.inc, line 731
Core drush commands.

Code

function _drush_core_directory($target = 'root', $component = 'path', $local_only = FALSE) {
  // Normalize to a sitealias in the target.
  $normalized_target = $target;
  if (strpos($target, ':') === FALSE) {
    if (substr($target, 0, 1) == '@') {
      $normalized_target = $target; // . ':%site';
    }
    else {
      // @self makes no sense before 'site' level.
      if (!drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_SITE)) {
        return FALSE;
      }
      $normalized_target = '@self:';
      if (substr($target, 0, 1) != '%') {
        $normalized_target .= '%';
      }
      $normalized_target .= $target;
    }
  }

  $additional_options = array();
  $values = drush_sitealias_evaluate_path($normalized_target, $additional_options, $local_only);
  if (isset($values[$component])) {
    // Hurray, we found the destination
    return $values[$component];
  }
  return NULL;
}