Open torotil opened 6 years ago
Are you asking about drush9 or drush8? please describe your setup a bit more.
This is about a Drupal7 multi-site setup. I’m happy to use whatever drush version works. Up to now I have used a patched version of drush8.
A basic test-setup would look like this:
/drupal-root
sites.php
):
default.example.com
pointing to sites/default
a.example.com
pointing to sites/a
What I want to achieve is that the correct -l
argument is automatically set based on the current shell working directory. In an imaginary shell session this would look like:
$ cd /drupal-root
$ drush status | grep URI
Site URI: https://default.example.com
$ cd sites/a
$ drush status | grep URI
Site URI: https://a.example.com
With the patch in #2580 I can do that when each sites folder contains a drushrc.php
with a line like $options['l'] = 'https://default.example.com';
Thanks for elaborating ... I dont have a suggestion offhand.
My understanding is that your drushrc.php approach should work with drush8. But we have certainly received reports of it not working - #2285. If that issue matches this one, please close this as a dupe.
No solution exists yet for drush9
@weitzman As far as I understood #2285 is something completely different. I only have one global drush installation but I want it to detect and use the correct site/*/drushrc.php
early enough to be able to configure the site url there as described in the imaginary shell session above. [… or any other means to achieve the same goal.]
Ok never mind. It seems that it does indeed work with 8.1.9.
Ok it seems I was wrong after all. It seems the installation I tested already had the patch from #2580. At least it does not work out-of-the-box with drush 8.1.18.
I found a fix that can be included in $HOME/.drush/drushrc.php
though:
$site_path = drush_site_path();
if (file_exists("$site_path/drushrc.php")) {
include "$site_path/drushrc.php";
}
With these lines the above shell session works. Without it I get a simple http://a
as URI.
Drush9 equivalent #3968
Hi I’d really like to make
drush
detect the correct uri based on the current working directory (without extra arguments todrush
).Currently I’m using #2580 with a site-specific
drushrc.php
to achieve this. The maintainers of drush seem not in favor of that solution though (see #1965 and #2055).As I’m not willing to maintain a drush fork ;) I’m looking for another way to achieve this. Any suggestions?