Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedClosing 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