Skip to content

Instantly share code, notes, and snippets.

@threeiem
Last active August 29, 2015 14:25
Show Gist options
  • Save threeiem/9aab2428e87eec516b78 to your computer and use it in GitHub Desktop.
Save threeiem/9aab2428e87eec516b78 to your computer and use it in GitHub Desktop.
Get all the multisite paths from Drush.
<?php
/**
* Get Local Paths.
*
* Returns an array of full paths to the local Drupal sites.
*
* @return array Array of full paths for local sites or an empty array.
*/
function _multisite_get_path(){
$sites_record = (array) drush_sitealias_get_record('@sites');
$self_record = (array) drush_sitealias_get_record('@self');
if (drush_valid_drupal_root($self_record['root'])){
foreach ($sites_record['site-list'] as $key => $value) {
$sites[$key] = str_replace('#', '/'.$sites_record['#name'].'/', $value);
}
}
return $sites;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment