Is there a way to get Drush to download all required dependancies for a specific module?

drupal.stackexchange https://drupal.stackexchange.com/questions/800

  •  16-10-2019
  •  | 
  •  

Pergunta

For example if you perform the following commands:

drush dl views
drush en views views_ui views_export

You will get the the following error when trying to enable the views modules:

Module views cannot be enabled because it depends on the following modules which could not be found: ctools

Is there a way to get drush to download required module dependancies?

Foi útil?

Solução

Drush 5 and up:

Newer versions of Drush (version 5 and higher) will ask you if you want to download the required dependencies when you enable (drush en) a module. It will also ask if you want to download the module itself if you didn't download it yet. Combined with the "-y" option (e.g. drush en views -y), everything will be downloaded and enabled automatically without asking further questions.

Note that the automatic downloading of dependencies may fail if the required module's name is not the same as its project name on drupal.org. For more info, see the my original answer for Drush 4 below.

Original answer (Drush 4):

No, there is no way to do that. The problem is that there is a difference between a module and a project. Often (but not always) the name of the project is identical to the module (or one of the modules) contained in the project. A single project (eg. Views) can contain multiple modules (views, views_ui, views_export). While drush dl downloads a project, drush en enables a module.

When a module declares dependencies, it declares dependencies on modules, not projects. When performing a drush en, Drush can check if the required module is available. However if it's not available, Drush has no way of knowing which project to download. For Drush to be able to automatically download required projects, work needs to be done in the underlying projects/modules infrastructure, so Drush can retrieve a mapping of projects and modules. See also Smarter handling of missing dependencies.

Outras dicas

Actually, drush5 (still in development) has a map of known, common dependencies (content.module, ctools, ...). So it does indeed download ctools for you in your example.

this is not anymore a problem since latest versions of drush does this "automagically":

The following projects have unmet dependencies:[ok]
answers requires strongarm, references, nodereference_url, nodereference_count, eva
Would you like to download them? (y/n):

Some modules, or projects include a drush make script, which can download dependencies and install external libraries.

However This is mostly not the case, and there are issues with nesting of drush make scripts. It is still worth looking out for with some of the modules which are more complicated to set up.

Try the Quick update module. It will download all missing dependency projects for you.

Here is a quote about it (from the module's project page):

... provides a quick way to batch install multiple new projects or all the missing dependency projects.

Drupal core provides a way to install module or theme one by one, but you can install multiple projects via the Quick update module. There is an admin UI to search the most installed projects easier.

Additional, Quick update module finds all missing dependency projects for you, then you can just select all of them from the admin UI and install them in a batch process.

The Quick update module depends on the Update module and uses the same workflow as the Update module. Thus, you can run the updates via the admin update page at /admin/reports/updates/update.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a drupal.stackexchange
scroll top