Jump to:
| Project: | Drush |
| Version: | 6.x-1.2 |
| Component: | Documentation |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
| Issue tags: | drushrc.php, module directory, multisite |
Issue Summary
Current status: fixed.
To always dl to sites/all/modules/contrib, you need to:
- check the directory exists (mkdir sites/all/modules/contrib)
- make sure you have the latest drush version (4.something), use "drush --version" to check
- now it should just work.
If you prefer a different location, you need to configure that in drushrc.php (site specific or global).
Original issue text
I have Drush and Drush_mm up and running on a new multisite installation of Drupal 6.9. I would like to have common modules and themes shared amongst all the sites, and also have site specific modules and themes in each specific site's module and or theme /contrib/ directories. But, if, for example, one had three urls registered, and each url had its own sites directory (ie /drupal-6/sites/siteOne/) leaving /sites/default/ unaltered, how would one get Drush to install the common modules in /sites/all/modules/contrib/... I believe, for the specific sites, I need to copy example.drushrc.php into each specific site folder, so the directory structure looks like so:
/drupal-6/sites/all/modules/contrib/ (drush, drush_mm, and the many more modules I will be installing with Drush!)
/drupal-6/sites/all/modules/custom/ (all site custom themes)
/drupal-6/sites/all/themes/contrib/ (all site themes)
/drupal-6/sites/all/themes/custom/ (all site custom themes)
??? /drupal-6/sites/all/drushrc.php ???
/drupal-6/sites/siteOne/modules/contrib/ (siteOne specific modules)
/drupal-6/sites/siteOne/modules/custom/ (siteOne specific custom modules)
/drupal-6/sites/siteOne/modules/themes/ (siteOne specific themes)
/drupal-6/sites/siteOne/modules/themes/ (siteOne specific themes)
/drupal-6/sites/siteOne/drushrc.php
/drupal-6/sites/siteTwo/modules/contrib/ (siteTwo specific modules)
/drupal-6/sites/siteTwo/modules/custom/ (siteTwo specific custom modules)
/drupal-6/sites/siteTwo/modules/themes/ (siteTwo specific themes)
/drupal-6/sites/siteTwo/modules/themes/ (siteTwo specific themes)
/drupal-6/sites/siteTwo/drushrc.php
/drupal-6/sites/siteThree/modules/contrib/ (siteThree specific modules)
/drupal-6/sites/siteThree/modules/custom/ (siteThree specific custom modules)
/drupal-6/sites/siteThree/modules/themes/ (siteThree specific themes)
/drupal-6/sites/siteThree/modules/themes/ (siteThree specific themes)
/drupal-6/sites/siteThree/drushrc.phpThen, if I have the siteOne, siteTwo, siteThree, etc, I edit each drushrc.php respectively for the site specific module and theme installations, by un-commenting and editing the 'option (r)' and 'option (l)' sections like so:
<?php
// $Id: example.drushrc.php,v 1.5.2.1 2008/11/14 22:08:56 grugnog Exp $
/*
* Examples of valid statements for a drushrc.php file. Use this file to cut down on
* typing of options and avoid mistakes.
*
* Rename this file to drushrc.php and
* optionally copy it to one of 5 convenient places. See drush_load_rc().
*/
// enable simulation mode
// $options['s'] = 1;
// specify a particular multisite
$options['l'] = 'http://siteOne.com';
// specify your Drupal core base directory (useful if you use symlinks)
$options['r'] = '/var/www/drupal-6';
// enable verbose mode
// $options['v'] = 1;
/*
* Customize this associative array with your own tables. This is the
* list of tables that are omitted by the 'sql dump' and 'sql load'
* commands when a skip is requested. You may add new tables to the existing array or add a new
* element.
*/
$options['skip-tables'] = array(
'common' => array('accesslog', 'cache', 'cache_filter', 'cache_menu', 'cache_page', 'history', 'search_dataset'$
);
// use cvs checkouts when installing modules
// an example of a command specific argument being set in drushrc.php
// $options['handler'] = 'cvs';
/**
* Variable overrides:
*
* To override specific entries in the 'variable' table for this site,
* set them here. Any configuration setting from the 'variable'
* table can be given a new value. We use the $override global here
* to make sure that changes from settings.php can not wipe out these
* settings.
*
* Remove the leading hash signs to enable.
*/
# $override = array(
# 'site_name' => 'My Drupal site',
# 'theme_default' => 'minnelli',
# 'anonymous' => 'Visitor',
# );So, with this setup, if I run the commanddrush install views cck ...
from the /www/drupal-6/ directory, the result is, as expected, that the modules are installed in:/sites/siteOne/modules/cck/sites/siteOne/modules/views etc
However, I want to have common modules installed in:/sites/all/modules/contrib/... and uncommon ones in:/sites/siteOne/modules/contrib/views etc.
So I'm not understanding how I can (or if I can) set up Drush to install some modules in/sites/all
and some in /sites/siteOne
or/sites/siteTwo/
etc. Ibid for themes.../sites/all/themes/contrib/...
and/sites/siteOne/themes/contrib/...
Am I completely missing something here?? Or is the only solution to have a fourth url and make 'siteFour' the 'default' site?
Thanks
Comments
#1
Ok, just in case anyone else is trying to understand how Drush can work in a multisite installation with non-default directories, I found this post http://agaricdesign.com/note/drush-feature-request-install-a-module-or-t... which explains that it currently cannot.
If anyone is using Drush on a multisite installation, I'm quite interested to learn how you are managing to distinguish between
/sites/all/modules/and/sites/siteOne/modules/. Or is this not currently possible?The benefits of this command line tool are enough that I wouldn't bother with adding 'contrib' and 'custom' directories in the module directories, but not so much if I can't use it to install site wide shared modules and a module or two that is site specific and not available to all.
Thanks
#2
That's an easy one : use the -l switch: drush -l http://siteone pm install module_name
How to install in custom folder(eg. contrib) is still unknown to me at this point.
#3
Thanks, but using the -l switch will result with the module being installed in /sites/siteOne/modules, not /sites/all/modules/, which does not leave the module available to say siteTwo. I'm trying to figure out how I can install modules in /sites/all/modules/, so all sites can share the module. I know how to install modules in specific sites, but i don't think Drush can install modules in the /sites/all/modules/ directory AND also in /sites/SiteOne/modules/ directory. Since one has to use the -l switch on a multisite installation, you are limited to installing modules on a per site basis, which would mean installing multiple copies of modules in different sites.
#4
Sorry, I didn't realize I was providing an answer to a different question(one that has not been asked..). I don't have an answer to your question ..
#5
No need to apologize, thanks for the input.
Though Drush comes packing many capabilities, my primary focus for giving it a spin was for installing modules, but in both /sites/all/modules/contrib and /sites/siteExample/modules/contrib/. Since it doesn't appear to allow this granularity, I'm going to give Drush a miss and continue installing modules via cvs. If I wasn't using Drupal's excellent multisite capabilities and simply simply hosting one site, I'd use Drush in a flash.
Cheers.
#6
I have a similar use case we have 3 folders per site.
modules/contrib
modules/modified-contrib
modules/custom
Custom will never get updated, as they are not in CVS, but modified-contrib are, and i would like to be able to exclude them from a general update. Also being able to install directly into these sub directories would be really helpful e.g.
php drush.php pm install backup_migrate -d contrib
then for the ignore dir perhaps a .drushignore text file in the root of any given modules folder might be a solution.
not sure if this should be an extra ticket or not... but seems to be a similar request.
#7
A destination option is now supported in pm commands and in drush_extras. Requires very latest of each, which unfortunately do not work together right now. drush_extras will be updated very soon. If in a hurry, try versions from march 10 or so.
#8
Try with a default site setup in the ../sites/default directory. I have a default site setup with a configured settings.php file in the ../sites/default/ directory, allowing me to run commands like
$drush pm install outline_designerThis will be installed in the ~/sites/all/modules dir. and may be manually moved to suit the layout of your modules folder.
#9
Automatically closed -- issue fixed for 2 weeks with no activity.
#10
I use a trick to solve this: make a symbolic link from sites/all/modules/ to one of your sites modules directory, becoming that particular site as the master for all sites.
#11
For my taste it should always copy to sites/*/modules/contrib, not to sites/*/modules.
I understand that I can do that with a commandline option, but is there any way to have this by default?
#12
This is not a complete answer to the original issue, but for the simpler situation in which you want to have modules split into sites/all/modules/contrib vs sites/all/modules/custom,
you can put:
$command_specific['dl']['destination'] = 'sites/all/modules/contrib';into your ~/.drush/drushrc.php, and future downloaded modules will land into the contrib subdirectory.
This works for me with the current drush v3 release.
Edit: Even better, you can place the drushrc.php inside your site directory so the setting is local to your project. It can go into sites/default and/or into sites/yourdomain.com.
#13
i organize my modules in groups (taxonomy,views,cck,theming,user etc.) - is it possible with the current version of drush to give an argument during the installation of a module to put it into a subfolder?
thanks momper
#14
as mentioned in this issue twice, there is a --destination option on dl command.
#15
Automatically closed -- issue fixed for 2 weeks with no activity.
#16
This doesn't help the original question but this may be helpful to some.
Drush 4.4 from Ubuntu repository as of today, automatically downloaded my modules to sites/all/contrib by default, I think it looks there first. I have custom and features folders as well.
=================
Update May 2nd, 2012 - This also works on Drush 5.1
#17
I found that I first need to mkdir sites/all/modules/contrib, before drush will download to this location.
Otherwise it will just download to sites/all/modules.
In any case, it is important to have the latest drush version (4.something), because earlier versions still dl to sites/all/modules by default.
#18
Good point Don, yes this is true.