2

I have a multisite architecture that has over 30 sites.

In one specific site search_api_solr version 7.x-1.0RC5 is installed, and I can see that it's enabled and being used in the module list.

In the common sites/all/modules folder search_api_solr 7.x-1.0-rc2 is there. When I do drush pm-list | grep search I can see that it's listed but "Not Installed."

Does this mean that none of the 30+ sites is using this module and it's safe to delete it? Or is that command simply telling me that it's not being used by the default install?

If the latter, how can I use Drush to tell me what specific sites are making use of modules in the common sites/all/modules directory?

EDIT:

@greg_1_anderson

I tried your solution with:

drush @sites pm-info search_api_solr --field=status

On each line of the output after hitting y I get something like:

.appdrupal#mysite.example.com >> blahblah : some.description

looks like the above output is 3 columns. Possible values for that 'blahblah' column seem to be numerous (requires, required by, type, title, description, version, date, package, 'group', files.. etc, etc..) nothing to denote if it's enabled)

I can see a couple times in the 'blahblah' "status", but it's not singled out. Ultimately this creates 1000s of lines of output. I tried to add | grep status but it hanged (I gave it 120 seconds).

Drupal is 7.26 and Drush version is 5.9 - thoughts?

6
  • I'd guess that output is for the default site, that's where Drush will look without an alias (I think). Could you set up an alias that looks at all of the sites and run the command @alias maybe?
    – Clive
    Commented Feb 19, 2014 at 15:17
  • I did some digging into aliases and saw that 'atSign'sites is available. drush 'atSign'sites pm-list | grep search drove my server crazy but finally spit out something that looked like garbage. Interestingly, the last 5 columns of the output listed package names from vertically, with one letter of the name on each row. by setting up an alias, you mean in PHP right? Create a file for a custom alias? (drush.ws/examples/example.aliases.drushrc.php) I wonder how that would be different from the built in @sites alias
    – blue928
    Commented Feb 19, 2014 at 16:00
  • Hmm, @sites hasn't worked for me for ages on multisites, that's why I was suggesting the manual way. But yeah, I did mean setting one up manually
    – Clive
    Commented Feb 19, 2014 at 16:02
  • Come to think of it, that's quite a specific bit of functionality, might be worth feature request to the module - what were you hoping your supplied parameters and output to look like? Something like drush @sites <command-name> <module-name> <version> as the input and a list of site names with a yes/no for the output?
    – Clive
    Commented Feb 19, 2014 at 16:18
  • @blue928: you may want to add a --yes after drush ATsites pm-list before piping it into grep search. Without --yes, Drush by default offers a confirmation "(y/n)" but you never see the prompt because it's being piped into your second command
    – Mark G
    Commented Feb 19, 2014 at 17:05

3 Answers 3

4

This works in Drush 6.x and later:

$ cd /path/to/drupalroot
$ drush @sites pm-info MODULENAME --fields=status
You are about to execute 'pm-info devel' non-interactively (--yes forced) on all of the following targets:
  /path/to/drupalroot#default
  /path/to/drupalroot#other
Continue?  (y/n): y
.path.to.drupalroot#other   >>  Status   :  enabled
.path.to.drupalroot#default >>  Status   :  enabled
0
0

from within the Drupal installation directory:

drush @sites pml --status=enabled -y | grep module_name
-1

You need to either set up Drush aliases, so you can run your command against all of the multisite's individual sites at once (as Clive suggests) or you can cd into each individual site (on D7, usually drupalroot/sites/A_SITE/) and run the command so it's checking using that individual site's configuration and not the default site's configuration (which is usually at drupalroot/sites/default/.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.