4

If you have drush >= 8 you can use drush pm-projectinfo to show a report of available projects and their extensions. If you use drush pm-projectinfo devel you should see the information about the devel module something like this:

 Name             :  Devel (devel)                       
 Type             :  module                              
 Version          :  7.x-1.3                             
 Status           :  1                                   
 Extensions       :  devel                               
                     devel_generate                      
                     devel_node_access                   
 Drush Commands   :  devel-download                      
                     devel-reinstall                     
                     fn-hook                             
                     fn-view                             
                     devel-token                         
 Datestamp        :  1338940281                          
 Path             :  sites/all/modules/development/devel 

I come from creating a custom module named my_custom_module, but when I use drush pm-projectinfo my_custom_module the output is:

 [warning] my_custom_module was not found.

It's very weird because I know that my module works fine, I use it every day, but the command doesn't work.

How can I solve this? Is it a problem with drush or is it a problem with my custom module?

2

The solution is very simple, you just need to add project property in your .info file.

In this case:

project = "my_custom_module"

The Drupal documentation page Writing module .info files (Drupal 7.x) says about the project property:

project (Discouraged, packaging use only)

Module maintainers should not use this at all. The packaging script on drupal.org will automatically place a string here to identify what project the module came from. This is primarily for the Update status module, so that Drupal installations can monitor versions of installed packages and notify administrators when new versions are available.

But as this is a custom module I think that I need to put this property in my .info file because if not, drush pm-projectinfo my_custom_module will not works.

Let's see why if you don't use the project property this doesn't works

Inside the drush code you can see the implementation of the drush pm-projectinfo command:

function drush_pm_projectinfo() {
  // Get specific requests.
  $requests = pm_parse_arguments(func_get_args(), FALSE);
  // Get installed extensions and projects.
  $extensions = drush_get_extensions();
  $projects = drush_get_projects($extensions);

If you use:

drush ev 'print_r(array_keys((drush_get_extensions())))' | grep my_custom_module

You will see something like this:

[112] my_custom_module

So, we need to test the next step:

drush ev 'print_r(array_keys(drush_get_projects(drush_get_extensions())))' | grep my_custom_module

Nothing to show

So, if we go inside the drush_get_projects() function we can found the following code in line 673:

  foreach ($extensions as $extension) {
    $extension_name = drush_extension_get_name($extension);
    $extension_path = drush_extension_get_path($extension);
    // Obtain the project name. It is not available in this cases:
    //   1. the extension is part of drupal core.
    //   2. the project was checked out from CVS/git and cvs_deploy/git_deploy
    //      is not installed.
    //   3. it is not a project hosted in drupal.org.
    if (empty($extension->info['project'])) {

And in number 3 we have our answer.

| improve this answer | |
  • @greg_1_anderson in the case of the custom modules what's the best option to use drush pm-projectinfo? – Adrian Cid Almaguer Sep 13 '16 at 16:56
  • Unfortunately, since Greg has not commented nor answered in here, he probably won't get an alert. – No Sssweat Sep 13 '16 at 21:36

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.