I'm wondering if it is possible to use a single Drush installation for multiple Drupal Installation.
I mean.. NO multisite... Just multiple drupal installs.
On local development machine we often have 5to10 different completely different drupal installation, and i was wondering i could use a single Drush installation to 'pm update' any of the other site..
I guess this is currently not possible, because drush doesn't know where to find the settings.php for those other installations.
So i was wondering if it were possible to provide the location to a separate 'settings.php' and have drush look at that installation instead of the one it is installed in..

Before i start working on this, i'd like to have some feedback to check whether this is possible at all..

Comments

moshe weitzman’s picture

drush module must currently be installed in each site. so no, this is not currently possible.

i do however alias the work 'drush' to a single drush.php on my PC but that doews no obviate the need to have the module installed on all sites.

this is an interesting feature for the drushrc.php file. i don't think it will ultimately work with the drupal bootstrap process, but you are welcome to try. note that you could always symlink drush into each site if that were more palatable to you than copying it many times.

demeester_roel’s picture

Isn't it so that, to install a module in drupal, the things needed are
* the drupal installation root [to be able to find the settings.php, and a location to store retrieved modules]
* a specific site from the multisite installation
* the database url [retrieved from a settings.php a given site within a given drupal installation root]

I haven't read through the code yet (i should do that first before assuming stuff), but i conceptually i don't understand why the drush module needs to be aware of drupal all together.
I guess dependency on update_status has to do with it..
Let me first check the code and than i'll bring in some more interesting input !

Frando’s picture

drush currently uses the drupal hook system to get a list of all implemented services (which live in the various submodules and can also live in any other enabled module). This works only for modules that are enabled on the used site. So currently drush has to be installed and enabled on all sites for which you want to use drush.

We could only stop using the hook system at all for drush. This would probably mean moving all drush services into .drush files, including all .drush files that can be found using drupal_system_listing() (e.g. in drush subdirectories and in all module folders) and then doing a stripped-down, own implentation of the basic hook system (this would be simple, we don't need much and performance is not much of a concern) ... A plus would be that drush code doesn't have to be parsed on all regular page requests (which currently is the case, as all enabled modules are always included and thus parsed).

moshe weitzman’s picture

We would lose the dependancy feature of modules, install/uninstall, etc. I'm not too keen on building our own simple hook system. But if someone wants to build this as a patch, we'll consider it.

The performance issue only affects people who run php without an opcode cache, and frankly those people are not serious about performance. You can't ignore an approximately 500% increase in performance and say you are serious. Furthermore, the registry patch will fix the parsing/performance issue for everyone else if we can get it in - http://drupal.org/node/221964.

Frando’s picture

All true. Neither am I too keen on doing this, just wanted to raise the possiblity. Actually, the first version of drush was built like this and I changed it to use the module/hook system, as it made many parts far simpler (and also made it far simpler for other modules to provide drush services, e.g. coder or devel).

moshe weitzman’s picture

I should mention that [hostmaster(http://drupal.org/project/hostmaster) makes a lot of use of a single drush instance to deploy to remote sites. perhaps worth a look to see what commands from there belong in core. Follow the links mentioned in that project.

moshe weitzman’s picture

Status: Active » Closed (duplicate)