function _drush_find_local_sites_in_sites_folder

8.0.x _drush_find_local_sites_in_sites_folder($a_drupal_root)
6.x _drush_find_local_sites_in_sites_folder($a_drupal_root)
7.x _drush_find_local_sites_in_sites_folder($a_drupal_root)
3.x _drush_find_local_sites_in_sites_folder($a_drupal_root)
4.x _drush_find_local_sites_in_sites_folder($a_drupal_root)
5.x _drush_find_local_sites_in_sites_folder($a_drupal_root)
master _drush_find_local_sites_in_sites_folder($a_drupal_root)

Return a list of all of the local sites at the specified 'sites' folder.

1 call to _drush_find_local_sites_in_sites_folder()
_drush_find_local_sites_at_root in includes/
Return a list of all of the local sites at the specified drupal root.


includes/, line 995
The site alias API.


function _drush_find_local_sites_in_sites_folder($a_drupal_root) {
  $site_list = array();

  // If anyone searches for sites at a given root, then
  // make sure that alias files stored at this root
  // directory are included in the alias search path

  $base_path = $a_drupal_root . '/sites';

  // TODO:  build a cache keyed off of $base_path (realpath($base_path)?),
  // so that it is guarenteed that the lists returned will definitely be
  // exactly the same should this routine be called twice with the same path.

  $files = drush_scan_directory($base_path, '/settings\.php/', array('.', '..', 'CVS', 'all'), 0, 1, 'filename', 1);
  foreach ($files as $filename => $info) {
    if ($info->basename == 'settings.php') {
      // First we'll resolve the realpath of the settings.php file,
      // so that we get the correct drupal root when symlinks are in use.
      $real_sitedir = dirname(realpath($filename));
      $real_root = drush_locate_root($filename);
      if ($real_root !== FALSE) {
        $a_drupal_site = $real_root . '#' . basename($real_sitedir);
      // If the symlink points to some folder outside of any drupal
      // root, then we'll use the
      else {
        $uri = drush_sitealias_site_dir_from_filename($filename);
        $a_drupal_site = $a_drupal_root . '#' . $uri;
      // Add the site if it isn't already in the array
      if (!in_array($a_drupal_site, $site_list)) {
        $site_list[] = $a_drupal_site;
  return $site_list;