function drush_sitealias_local_site_path

8.0.x drush_sitealias_local_site_path($alias_record)
6.x drush_sitealias_local_site_path($alias_record)
7.x drush_sitealias_local_site_path($alias_record)
3.x drush_sitealias_local_site_path($alias_record)
4.x drush_sitealias_local_site_path($alias_record)
5.x drush_sitealias_local_site_path($alias_record)
master drush_sitealias_local_site_path($alias_record)

Return the full path to the site directory of the given alias record.


$alias_record: The alias record

Return value

The path to the site directory of the associated alias record, or NULL if the record is not a local site.

7 calls to drush_sitealias_local_site_path()
drush_core_pre_site_install in commands/core/
Perform setup tasks for installation.
drush_sitealias_alias_path in includes/
Return the array of paths where alias files are searched for.
drush_sitealias_cache_alias_by_path in includes/
Cache the specified alias in the alias path cache. The alias path cache creates a lookup from the site folder (/path/to/drupal/sites/default) to the provided alias record.
drush_sitealias_get_record in includes/
Get a site alias record given an alias name or site specification.
drush_sitealias_lookup_alias_by_path in includes/
Look for a defined alias that points to the specified site directory. The cache is tested first; if nothing is cached, then an exhaustive search is done for the specified site. If the exhaustive search returns a match, then it is cached.

... See full list


includes/, line 450
The site alias API.


function drush_sitealias_local_site_path($alias_record) {
  $result = NULL;

  if (isset($alias_record['root']) && !isset($alias_record['remote-host'])) {
    if (isset($alias_record['uri'])) {
      $uri = $alias_record['uri'];
      $uri = preg_replace('#^[^:]*://#', '', $uri);
      while (!$result && !empty($uri)) {
        if (file_exists($alias_record['root'] . '/sites/sites.php')) {
          $sites = array();
          include ($alias_record['root'] . '/sites/sites.php');
          if (array_key_exists($uri, $sites)) {
            $result = $alias_record['root'] . '/sites/' . $sites[$uri];
        if (!$result) {
          $result = ($alias_record['root'] . '/sites/' . drush_sitealias_uri_to_site_dir($uri, drush_sitealias_get_root($alias_record)));
        $result = realpath($result);
        $uri = preg_replace('#^[^.]*\.*#', '', $uri);
    if (!$result) {
      $result = realpath($alias_record['root'] . '/sites/default');

  return $result;