I'm getting the following error when trying to enable the Boomerang module without first enabling the library module:

Fatal error: Call to undefined function libraries_get_libraries() in /home/quickstart/websites/d6sandbox.dev/sites/all/modules/contrib/boomerang-HEAD/boomerang.install on line 17

...though the libraries module is defined as a dependency. I was expecting Drush to tell me "The following projects will be enabled: libraries". If I try enabling Boomerang from the modules page, I'm told "You must enable the Libraries module to install Boomerang."

In case it might help, here's the call stack:

Call Stack:
    0.0039     114160   1. {main}() /home/quickstart/drush/drush.php:0
    0.0441    1523172   2. drush_main() /home/quickstart/drush/drush.php:40
    0.7645   12949620   3. drush_dispatch() /home/quickstart/drush/drush.php:90
    0.7645   12951812   4. call_user_func_array() /home/quickstart/drush/includes/drush.inc:51
    0.7645   12952220   5. drush_command() /home/quickstart/drush/includes/drush.inc:0
    0.7652   12955504   6. call_user_func_array() /home/quickstart/drush/includes/command.inc:381
    0.7652   12955696   7. drush_invoke() /home/quickstart/drush/includes/command.inc:0
    0.7668   12967740   8. call_user_func_array() /home/quickstart/drush/includes/command.inc:330
    0.7668   12968156   9. drush_pm_enable() /home/quickstart/drush/includes/command.inc:0
    1.4824   13512428  10. drupal_check_module() /home/quickstart/drush/commands/pm/pm.drush.inc:385
    1.5636   13538924  11. module_invoke() /home/quickstart/websites/d6sandbox.dev/includes/install.inc:721
    1.5636   13539776  12. call_user_func_array() /home/quickstart/websites/d6sandbox.dev/includes/module.inc:462
    1.5636   13540224  13. boomerang_requirements() /home/quickstart/websites/d6sandbox.dev/includes/module.inc:0
CommentFileSizeAuthor
#5 boomerang-drush-fatal-error-940706.patch786 byteshanoii

Comments

jonhattan’s picture

Assigned: Unassigned » jonhattan

This is because we check requirements for all modules and then enable any of them. So at the time we check requirements for boomerang, libraries is not enabled.

jonhattan’s picture

Project: Drush » Boomerang
Version: All-versions-3.3 » 6.x-1.x-dev
Component: PM (dl, en, up ...) » Code
Assigned: jonhattan » Unassigned
Priority: Minor » Critical

woah same result in drupal:

Fatal error: Call to undefined function libraries_get_libraries() in /var/www/drupal-6.x-cvs/sites/d6/modules/boomerang/boomerang.install on line 18

It can be fixed in drush with a refactoring of pm-enable but we will stay in sync with drupal. Moving to boomerang issue queue.

to replicate: uninstall libraries and try installing boomerang and libraries at the same time.

jonhattan’s picture

Title: Getting "Call to undefined function" error enabling a module when the function is in a dependency » "Call to undefined function libraries_get_libraries()" when libraries module is not previously installed.
matt v.’s picture

Priority: Critical » Normal

jonhattan,

Thanks for looking into that. For what it's worth, I was testing on Pressflow, which was giving me the "You must enable the Libraries module to install Boomerang" message if I tried enabling Boomerang by itself. It worked fine if I enabled it at the same time as the Libraries module. After seeing your response in #2, I tested in Drupal and got the same error you did. Pressflow apparently handles things a bit differently, in this case.

I'm the developer of the Boomerang module, so I guess I'll have to look into a fix for this myself. The hook_requirements implementation I used is based on code in 3 Tips For Using External Libraries With Drupal. It would be relatively easy to miss the issue though, if you already had the Libraries module installed.

hanoii’s picture

Status: Active » Needs review
StatusFileSize
new786 bytes

Just a small requirement addition for the libraries module to be enabled. This will prevent the fatal error.

matt v.’s picture

Status: Needs review » Closed (fixed)

@hanoii Thanks! I've applied the patch.