function drush_sitealias_quick_lookup_cached_alias_by_path

8.0.x drush_sitealias_quick_lookup_cached_alias_by_path($path)
6.x drush_sitealias_quick_lookup_cached_alias_by_path($path)
7.x drush_sitealias_quick_lookup_cached_alias_by_path($path)
master 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.


$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/
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.


includes/, line 2223
The site alias API.


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));
    $alias_record['#name'] = $alias_name;
  return $alias_record;