Skip to content

Instantly share code, notes, and snippets.

@jfitzsimmons2
Last active March 20, 2022 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfitzsimmons2/f87ad85222e57721c8d180d54acefbb7 to your computer and use it in GitHub Desktop.
Save jfitzsimmons2/f87ad85222e57721c8d180d54acefbb7 to your computer and use it in GitHub Desktop.
Drush 9 @sites workaround for Drupal 8
#!/usr/bin/php
<?php
/*
* Usage:
* ./drall.php [local/dev8/stage8/ww1] drushcommand
* ex: ./drall.php local cim
*
*/
// Path to sites.php file.
include('docroot/sites/sites.php');
$done = [];
$argv = $_SERVER['argv'];
array_shift($argv);
$env = array_shift($argv);
$parameters = implode(' ', $argv);
$commandPattern = "drush --uri=:key $parameters";
foreach ($sites as $key => $site) {
if (count($argv) >= 1 && strpos($key, $env) !== false) {
$command = str_replace(':key', $key, $commandPattern);
echo "Executing command `$command` on $site\n";
`$command`;
$done[] = $site;
}
}
$sites['local.oswego.edu.accessibility']='accessibility';
$sites['dev8.oswego.edu.accessibility']='accessibility';
$sites['stage8.oswego.edu.accessibility']='accessibility';
$sites['ww1.oswego.edu.accessibility']='accessibility';
$sites['local.oswego.edu.orientation']='orientation';
$sites['dev8.oswego.edu.orientation']='orientation';
$sites['stage8.oswego.edu.orientation']='orientation';
$sites['ww1.oswego.edu.orientation']='orientation';
@jigarius
Copy link

Cool! Came across this gist while looking for jigarius/drall on Google to see if my package was searchable. The package jigarius/drall brings this functionality out of the box and you might find it useful 👨‍💻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment