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:%pathalias, 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()
drush_core_drupal_directory in commands/core/core.drush.inc
Command callback.

File

commands/core/core.drush.inc, line 1232
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) != '@') {
      // drush_sitealias_evaluate_path() requires bootstrap to database.
      if (!drush_bootstrap_to_phase(DRUSH_BOOTSTRAP_DRUPAL_DATABASE)) {
        return drush_set_error('DRUPAL_SITE_NOT_FOUND', dt('You need to specify an alias or run this command within a drupal site.'));
      }
      $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];
  }
}