This may be a duplicate of https://drupal.org/node/673998, which is the only ticket I found that relates.

I believe the fix is to add drupal_load('module', 'media'); just before

foreach ($types as $name => $type) {
    media_type_save($type);

inside media_install(). Media_type_save() is called in media_update_7002(), and is preceeded by drupal_load('module', 'media');.

This is all from when I got the following errors when attempting to enable media module with Drush:

PHP Fatal error:  Call to undefined function media_type_save() in ...../sites/all/modules/contrib/media/media.install on line 209
PHP Stack trace:
PHP   1. {main}() /usr/share/drush/drush.php:0
PHP   2. drush_main() /usr/share/drush/drush.php:41
PHP   3. drush_dispatch() /usr/share/drush/drush.php:101
PHP   4. call_user_func_array() /usr/share/drush/includes/command.inc:214
PHP   5. drush_command() /usr/share/drush/includes/command.inc:0
PHP   6. _drush_invoke_args() /usr/share/drush/includes/command.inc:806
PHP   7. call_user_func_array() /usr/share/drush/includes/command.inc:134
PHP   8. drush_pm_enable() /usr/share/drush/includes/command.inc:0
PHP   9. drush_module_enable() /usr/share/drush/commands/pm/pm.drush.inc:708
PHP  10. module_enable() /usr/share/drush/commands/core/drupal/environment.inc:103
PHP  11. module_invoke() ...../includes/module.inc:477
PHP  12. call_user_func_array() ...../includes/module.inc:866
PHP  13. media_install() ...../includes/module.inc:0
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: Call to undefined function media_type_save() in
...../sites/all/modules/contrib/media/media.install, line 209

Comments

Chris Matthews’s picture

Version: 7.x-2.0-alpha2 » 7.x-2.x-dev
Status: Needs review » Closed (outdated)

Closing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team