Closed (fixed)
Project:
Drush
Version:
All-versions-3.0
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
18 Jun 2010 at 09:52 UTC
Updated:
21 Aug 2010 at 12:50 UTC
I've a multi-site installation that don't have any 'sites/default/settings.php' file, instead I have 'sites/site1.com/settings.php', 'sites/site2.com/settings.php', etc. Trying to use the '@sites' alias (e.g. for a pm-update) always fails with something like:
Could not find a Drupal settings.php file at [error]
./sites/default/settings.php.
The drush command '@sites pm-update' could not be found. [error]
Could drush not strictly depend to 'sites/default/settings.php' in multi-site installations?
As a workaround I've created an empty 'sites/default/settings.php' file (with a simple touch command), and this seems to let drush working; but I'm not sure that this is a safe workaround, can someone confirm?
Comments
Comment #1
greg.1.anderson commentedMake sure that you have correctly set your --root before you use @sites, or use the conjoined format:
/path/to/drupal/@sites.Re-open if you've done that and it's still not working.
Edit 18 June: Fixed a typo above; was missing a '/'.
Comment #2
Kafu commentedHi Greg,
I've removed the empty 'sites/default/settings.php' file and I've tried your suggestion (trying different syntaxes, as I'm not sure what one to use), but the results are:
I've tried running the commands both from the drupal installation directory (/usr/local/home/daniele/drupal/drupal2/drupal) that from the drush installation directory. Same results.
Comment #3
greg.1.anderson commentedIf you can say
drush -r path -l mysite1.com statusanddrush -r path -l mysite2.com status, then you should also be able to saydrush -r path @sitesordrush path/@sitesto use the @sites alias. (Sorry for the typo in #2 above).The 'path' you use should be the path to the folder that contains your drupal folder; this path should point to the location that holds sites/mysite1.com/settings.php, etc.
The error "Could not find a Drupal settings.php file at ./sites/default/settings.php" means that drush could not bootstrap your site; if no site is specified, it tries 'default' before failing. Perhaps your path in -r is not pointing at the right location?
Comment #4
Kafu commentedThe path is strange but is right. The problem is when using the --root/-r argument with @sites alias:
But:
I've also noted that output is not always produced when using @sites alias, e.g.:
but:
Two empty lines are written after the confirmation.
This is not important for 'cache-clear', but does 'update' (or other important commands) writes out all the output?
Comment #5
greg.1.anderson commentedYep, this is a bug. Per #4 above:
../../drush/drush -r /usr/local/home/daniele/drupal/drupal2/drupal @sites statusDoes not workIf you add -l
-l localsite2.comto the above, then it works again. The problem is that drush tries to bootstrap a site before it processes the @sites alias, so if -l is not set and there is no site in 'default', then @sites will fail when it should succeed.(@Kafu: The last thing you mention, where messages and --pipe options are not correctly merged and output with site lists, is a duplicate of an existing issue.)
Comment #6
greg.1.anderson commentedComment #7
greg.1.anderson commentedFixed.
Comment #8
greg.1.anderson commentedRecommended for 3.x.
--- includes/sitealias.inc 2 Aug 2010 14:16:23 -0000 1.48
+++ includes/sitealias.inc 4 Aug 2010 06:04:08 -0000
@@ -392,6 +392,9 @@ function _drush_sitealias_find_and_load_
}
else {
$drupal_root = drush_get_context('DRUSH_DRUPAL_ROOT');
+ if ($drupal_root == NULL) {
+ $drupal_root = drush_get_option(array('r', 'root'), drush_locate_root());
+ }
}
if (isset($drupal_root) && !is_array($drupal_root)) {
drush_sitealias_create_sites_alias($drupal_root);
Comment #9
greg.1.anderson commentedComment #10
moshe weitzman commentedCommitted to 6--3 since it is critical and we need to roll a release.