Created
November 4, 2020 17:43
-
-
Save alex-moreno/13b434b4acff3ce5ee3c569883ddb7fb to your computer and use it in GitHub Desktop.
Execute drush for a given list of sites
This file contains 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 | |
// clearcacheall.php alias/druh >> cacheclear.log | |
$list_sites = []; | |
$drush_alias = $argv[1]; | |
// Iterate on them to execute the drush command. | |
foreach ($list_sites as $site) { | |
execDrushCommand($site['alias'], $drush_alias); | |
} | |
/** | |
* Execute drush. | |
* | |
* @param [type] $site_alias | |
* @param [type] $drush_alias | |
* @return void | |
*/ | |
function execDrushCommand($site_alias, $drush_alias) | |
{ | |
// Iterate on them to execute the drush command. | |
$result = exec("drush $drush_alias -l $site_alias [COMMAND_HERE] ", $output, $return); | |
echo "Result:: "; | |
print_r($result); | |
echo "Output:: "; | |
print_r($output); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment