3

I'm using a multi-site setup with Drupal 7.14 core, and I want to disable some modules within my sites/all/modules shared folder. One of them in particular is the File_Entity module.

Is there a way (drush, programmatically, bash script, etc) to check if another module (e.g. Views, custom CCK) is using it? drush pml | grep File Entity only let me see what is enabled or disabled, not if it is currently in use, or safe to remove.

4
drush pm-info mymodule|grep "Required by"

grep or don't grep is up to you ;)

Beware this does not list fields that require the module. This implies to views that use fields too.

fields: admin/reports/fields

views: admin/reports/fields/views-fields

those will list fields only, so if you have special pagers, formatters or something else that come from a module you will still have to search for them.

| improve this answer | |
  • 1
    Yes, there can be dependencies in configuration as well as in code. For example if you create a view using a handler supplied by a module, then uninstall that module the view will break. Can be hard to track all these down. – Alfred Armstrong Mar 13 '13 at 17:21
  • As an example of a real stinker, suppose a module includes a template preprocess function that rearranges the content of certain variables. Your theme might depend on this having been done, but try tracking that down without code inspection! – Alfred Armstrong Mar 13 '13 at 17:24
  • hopefully those are listed as dependencies in the .info file for the actual module or theme (thats what that notice is for) if not you have a problem - but that mess is caused by bad style then. – Andre Baumeier Mar 13 '13 at 17:25
  • 2
    Sure, that's what a developer /should/ do, but how many do when writing a custom theme for a single site? Considering how many times I've found SQL queries in template.php functions, that's a relatively minor offence :) – Alfred Armstrong Mar 13 '13 at 17:32
  • So, how can I achive similar result with Drush 9 ? – Vlad Moyseenko Jun 22 '18 at 11:31
0

There is no drush pm-info command in Drush 9.3, it was replaced pm:list.

(https://github.com/drush-ops/drush/issues/3487)

But now there is no Required by field in a field list
(see FIELDS section in drush pm:list --help)

Current workaround is just open /admin/modules page and look for Required by,
or use some php code if you have access to the drush.

drush ev '$module = "views"; $modules = _system_rebuild_module_data(); \Drupal::moduleHandler()->buildModuleDependencies($modules); var_dump($modules[$module]->required_by);'

NOTE: be worried with php code, may cause performance issues.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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