Closed (fixed)
Project:
Drush
Component:
Base system (internal API)
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Jan 2012 at 13:20 UTC
Updated:
8 Feb 2012 at 17:40 UTC
I set up -l http://chx.itv.com and then this is the value of drush_get_option('uri');
string(18) "http://chx.itv.com"
string(18) "http://chx.itv.com"
string(18) "http://chx.itv.com"
string(18) "http://chx.itv.com"
string(18) "http://chx.itv.com"
string(18) "http://chx.itv.com"
string(14) "http://default"
string(14) "http://default"
I have no idea why. I tried symlinking sites/chx.itv.com to default but that didnt quite help. I have no idea where to look.
Comments
Comment #1
chx commentedTo clarify further, this means that
$_SERVER['HTTP_HOST']gets set to 'default' no matter what because as drush bootstraps, it loses the pre-set uri value.Comment #2
chx commentedI was using the si command.
Comment #3
greg.1.anderson commentedHi chx, seems like you have the right idea; set up --root and --uri, or equivalently, -r and -l, to specify the Drupal root and site URI to use. This should set
$_SERVER['HTTP_HOST']as you expect.Could you give more info on how you are calling Drush, per guidelines on the issue submission page? e.g. show drush status output, commandline to drush that you are using, relevant sections of drushrc.php, --debug output, etc.
Comment #4
greg.1.anderson commentedSorry, I missed #2. Use
--sites-subdirrather than -l with the site-install command. I'm not entirely sure that site-install will set $_SERVER['HTTP_HOST'], so this might in fact be a bug with si.Comment #5
greg.1.anderson commentedJust took a quick look at the code (Drush-5.x), and $_SERVER['HTTP_HOST'] is set. In D6, we bootstrap to DRUPAL_CONFIGURATION; otherwise we only go to DRUPAL_SITE, which sets HTTP_HOST. If you use --sites-subdir, then it should work.
Note that we can't use -l or --uri for this operation in site-install; if we did that, Drush would try to bootstrap the site before it was initialized, which could cause problems when we tried to bootstrap it for real.Here is the si bootstrap code in question, for reference: (
drush/commands/core/site_install.drush.inc)Comment #6
greg.1.anderson commentedHm, we also have this in the validate function:
Perhaps the scenario above could be made to work with a slight code modification. I'm not really sure why we have --sites-subdir instead of just using --uri here. Could re-open as a feature request if it was felt to be compelling enough.
Comment #7
moshe weitzman commentedI think that if we require folks to specify a --uri in simple form (without http and such) then we can probably get rid of sites-subdir.
Comment #8
greg.1.anderson commented--sites-subdir allows people to specify the port number and such; unless we gave the same level of control with --uri, it wouldn't be good to get rid of --sites-subdir.