function _core_path_aliases

8.0.x core.drush.inc _core_path_aliases($project = '')
6.x core.drush.inc _core_path_aliases($project = '')
7.x core.drush.inc _core_path_aliases($project = '')
3.x core.drush.inc _core_path_aliases($project = '')
4.x core.drush.inc _core_path_aliases($project = '')
5.x core.drush.inc _core_path_aliases($project = '')
master core.drush.inc _core_path_aliases($project = '')
2 calls to _core_path_aliases()
drush_sitealias_evaluate_paths_in_options in includes/sitealias.inc
Given a properly-escaped options string, replace any occurance of %files and so on embedded inside it with its corresponding path.
_core_site_status_table in commands/core/core.drush.inc

File

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

Code

function _core_path_aliases($project = '') {
  $paths = array();
  $site_wide = drush_drupal_sitewide_directory();
  $boot = drush_get_bootstrap_object();
  if ($drupal_root = drush_get_context('DRUSH_DRUPAL_ROOT')) {
    $paths['%root'] = $drupal_root;
    if ($site_root = drush_get_context('DRUSH_DRUPAL_SITE_ROOT')) {
      $paths['%site'] = $site_root;
      if (is_dir($modules_path = $boot->conf_path() . '/modules')) {
        $paths['%modules'] = $modules_path;
      }
      else {
        $paths['%modules'] = ltrim($site_wide . '/modules', '/');
      }
      if (is_dir($themes_path = $boot->conf_path() . '/themes')) {
        $paths['%themes'] = $themes_path;
      }
      else {
        $paths['%themes'] = ltrim($site_wide . '/themes', '/');
      }
      if (drush_drupal_major_version() >= 8 && drush_has_boostrapped(DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION)) {
        try {
          if (isset($GLOBALS['config_directories'])) {
            foreach ($GLOBALS['config_directories'] as $label => $unused) {
              $paths["%config-$label"] = config_get_config_directory($label);
            }
          }
        }
        catch (Exception $e) {
          // Nothing to do.
        }
      }

      if (drush_has_boostrapped(DRUSH_BOOTSTRAP_DRUPAL_FULL)) {
        $paths['%files'] = drush_file_get_public();
        if ($private_path = drush_file_get_private()) {
          $paths['%private'] = $private_path;
        }
      }

      if (function_exists('file_directory_temp')) {
        $paths['%temp'] = file_directory_temp();
      }
      // If the 'project' parameter was specified, then search
      // for a project (or a few) and add its path to the path list
      if (!empty($project)) {
        drush_include_engine('drupal', 'environment');
        $projects = array_merge(drush_get_modules(), drush_get_themes());
        foreach (explode(',', $project) as $target) {
          if (array_key_exists($target, $projects)) {
            $paths['%' . $target] = $drupal_root . '/' . _drush_extension_get_path($projects[$target]);
          }
        }
      }
    }
  }

  // Add in all of the global paths from $options['path-aliases']
  $paths = array_merge($paths, drush_get_option('path-aliases', array()));

  return $paths;
}