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 = '')
1 call to _core_path_aliases()

File

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

Code

function _core_path_aliases($project = '') {
  $paths = array();
  $phase = drush_get_context('DRUSH_BOOTSTRAP_PHASE');
  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 = conf_path() . '/modules')) {
        $paths['%modules'] = $modules_path;
      }
      else {
        $paths['%modules'] = 'sites/all/modules';
      }
      if (is_dir($themes_path = conf_path() . '/themes')) {
        $paths['%themes'] = $themes_path;
      }
      else {
        $paths['%themes'] = 'sites/all/themes';
      }
      if (drush_drupal_major_version() >= 7) {
        if (drush_get_context('DRUSH_BOOTSTRAP_PHASE') >= DRUSH_BOOTSTRAP_DRUPAL_SITE) {
          $paths['%files'] = variable_get('file_public_path', conf_path() . '/files');
          $private_path = variable_get('file_private_path', FALSE);
          if ($private_path !== FALSE) {
            $paths['%private'] = $private_path;
          }
        }
      }
      elseif (function_exists('file_directory_path')) {
        $paths['%files'] = file_directory_path();
      }
      // 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)) {
        foreach (explode(',', $project) as $target) {
          $path = drush_core_find_project_path($target);
          if (isset($path)) {
            $paths['%' . $target] = $path;
          }
        }
      }
    }
  }

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

  return $paths;
}