function drush_sitealias_uri_to_site_dir

8.0.x drush_sitealias_uri_to_site_dir($uri, $site_root = NULL)
6.x drush_sitealias_uri_to_site_dir($uri)
7.x drush_sitealias_uri_to_site_dir($uri, $site_root = NULL)
3.x drush_sitealias_uri_to_site_dir($uri)
4.x drush_sitealias_uri_to_site_dir($uri)
5.x drush_sitealias_uri_to_site_dir($uri)
master drush_sitealias_uri_to_site_dir($uri, $site_root = NULL)

Convert from a URI to a site directory.


uri: A uri, such as

Return value

string A directory, such as

7 calls to drush_sitealias_uri_to_site_dir()
drush_sitealias_alias_record_to_spec in includes/
Convert from an alias record to a site specification
drush_sitealias_get_record in includes/
Get a site alias record given an alias name or site specification.
drush_sitealias_local_site_path in includes/
Return the full path to the site directory of the given alias record.
_drush_sitealias_add_transient_defaults in includes/
Add "transient" default values to the given alias record. The difference between a static default and a transient default is that static defaults -always- exist in the alias record, whereas transient defaults are only added if the given…
_drush_sitealias_find_record_for_local_site in includes/
If '$alias' is the name of a folder in the sites folder of the given drupal root, then build an alias record for it

... See full list


includes/, line 1525
The site alias API.


function drush_sitealias_uri_to_site_dir($uri) {
  $uri = str_replace('http://', '', $uri);
  if (drush_is_windows()) {
    // Handle absolute paths on windows
    $uri = str_replace(array(':/', ':\\'), array('.', '.'), $uri);

  $hostname = str_replace(array('/', ':', '\\'), array('.', '.', '.'), $uri);

  // Check sites.php mappings
  $site_dir = drush_site_dir_lookup_from_hostname($hostname);

  return $site_dir ? $site_dir : $hostname;