Last active
August 29, 2015 14:25
-
-
Save threeiem/77e8e666b965239919fc to your computer and use it in GitHub Desktop.
Drush to return all the local aliases for drush. Used for multisite installations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get Local Alaises. | |
* | |
* Returns an array that is indexed by it's alias ID without that '@'. | |
* | |
* @return array Returns an array of local sites in the Drush site aliases. | |
*/ | |
function _multisite_get_local_alias($group = NULL) { | |
$alias = array(); | |
$result = (array) _drush_sitealias_find_and_load_all_aliases(); | |
if (empty($group) == TRUE) { | |
foreach ($result as $id => $site) { | |
if (empty($site['root']) == FALSE) { | |
$alias[$site['#name']] = $site; | |
} | |
} | |
} else { | |
foreach ($results as $id => $site) { | |
$current_group = substr($id, 0, strpos($id, '.')); | |
if ($group == $current_group) { | |
$alias[$sites['#name']] = $site; | |
} | |
} | |
} | |
return $alias; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment