function media_update_7201 in D7 Media 7.4
Same name and namespace in other branches
- 7.2 media.install \media_update_7201()
- 7.3 media.install \media_update_7201()
Handle existing media fields.
Enable the new Media Field module if this site uses "media" fields. File fields are now preferred for storing media.
File
- ./
media.install, line 599 - Install, update and uninstall functions for the Media module.
Code
function media_update_7201() {
$fields = field_info_fields();
foreach ($fields as $field) {
if ($field['type'] == 'media') {
// This update function may run even if Media is not enabled. Don't enable
// Media Field if its dependencies aren't already enabled.
module_enable(array(
'mediafield',
), FALSE);
// Update entries in file_usage so that they are associated with Media
// Field rather than Media.
// @TODO This update function may conflict with
// http://drupal.org/node/1268116
db_update('file_usage')
->condition('module', 'media')
->fields(array(
'module' => 'mediafield',
))
->execute();
return t('The "Media" field type has been moved to the new "Media Field" module. This site uses media fields, so the Media Field module has been enabled.');
}
}
return t('The "Media" field type has been moved to the new "Media Field" module. File fields can be used to store media.');
}