function _drush_find_local_sites_at_root

8.0.x sitealias.inc _drush_find_local_sites_at_root($a_drupal_root = '', $search_depth = 1)
6.x sitealias.inc _drush_find_local_sites_at_root($a_drupal_root = '', $search_depth = )
7.x sitealias.inc _drush_find_local_sites_at_root($a_drupal_root = '', $search_depth = 1)
3.x sitealias.inc _drush_find_local_sites_at_root($a_drupal_root = '', $search_depth = 1)
4.x sitealias.inc _drush_find_local_sites_at_root($a_drupal_root = '', $search_depth = 1)
5.x sitealias.inc _drush_find_local_sites_at_root($a_drupal_root = '', $search_depth = 1)
master sitealias.inc _drush_find_local_sites_at_root($a_drupal_root = '', $search_depth = 1)

Return a list of all of the local sites at the specified drupal root.

2 calls to _drush_find_local_sites_at_root()
drush_sitealias_create_sites_alias in includes/sitealias.inc
_drush_sitealias_find_local_sites in includes/sitealias.inc
Search for drupal installations in the search path.

File

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

Code

function _drush_find_local_sites_at_root($a_drupal_root = '', $search_depth = 1) {
  $site_list = array();
  $base_path = (empty($a_drupal_root) ? drush_get_context('DRUSH_DRUPAL_ROOT') : $a_drupal_root);
  if (!empty($base_path)) {
    if (drush_valid_root($base_path)) {
      // If $a_drupal_root is in fact a valid drupal root, then return
      // all of the sites found inside the 'sites' folder of this drupal instance.
      $site_list = _drush_find_local_sites_in_sites_folder($base_path);
    }
    else {
      $bootstrap_files = drush_scan_directory($base_path, '/' . basename(DRUSH_DRUPAL_SIGNATURE) . '/', array('.', '..', 'CVS', 'examples'), 0, drush_get_option('search-depth', $search_depth) + 1, 'filename', 1);
      foreach ($bootstrap_files as $one_bootstrap => $info) {
        $includes_dir = dirname($one_bootstrap);
        if (basename($includes_dir) == basename(dirname(DRUSH_DRUPAL_SIGNATURE))) {
          $drupal_root = dirname($includes_dir);
          $site_list = array_merge(_drush_find_local_sites_in_sites_folder($drupal_root), $site_list);
        }
      }
    }
  }
  return $site_list;
}