function drush_sitealias_quick_lookup_cached_alias_by_path

8.0.x sitealias.inc drush_sitealias_quick_lookup_cached_alias_by_path($path)
6.x sitealias.inc drush_sitealias_quick_lookup_cached_alias_by_path($path)
7.x sitealias.inc drush_sitealias_quick_lookup_cached_alias_by_path($path)
master sitealias.inc drush_sitealias_quick_lookup_cached_alias_by_path($path)

Look for a cached alias that points to the specified site directory. Nothing is returned if there is no matching cached alias.

Parameters

$path: /path/to/drupal/sites/default

Return value

An alias record for the provided path

1 call to drush_sitealias_quick_lookup_cached_alias_by_path()
drush_sitealias_lookup_alias_by_path in includes/sitealias.inc
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.

File

includes/sitealias.inc, line 2270
The site alias API.

Code

function drush_sitealias_quick_lookup_cached_alias_by_path($path) {
  $alias_record = array();
  $cid = drush_get_cid('alias-path-', array(), array($path));
  $alias_path_cache = drush_cache_get($cid);
  if (isset($alias_path_cache->data)) {
    $alias_name = $alias_path_cache->data['#name'];
    $alias_file = $alias_path_cache->data['#file'];

    $alias_record = _drush_sitealias_find_and_load_alias_from_file($alias_name, array($alias_file));
    _drush_sitealias_add_inherited_values_to_record($alias_record);
    $alias_record['#name'] = $alias_name;
  }
  return $alias_record;
}