Revision 2b3c8cc1
Added by Assos Assos about 9 years ago
drupal7/sites/all/modules/media/modules/media_migrate_file_types/includes/media_migrate_file_types.pages.inc | ||
---|---|---|
150 | 150 |
$fields_to_move = array_diff($old_fields, $new_fields); |
151 | 151 |
$fields_to_drop = array_diff($old_fields, $fields_to_move); |
152 | 152 |
|
153 |
db_update('field_config_instance') |
|
154 |
->fields(array('bundle' => $bundle_new->type)) |
|
155 |
->condition('entity_type', 'file') |
|
156 |
->condition('bundle', $bundle_old->type) |
|
157 |
->condition('field_name', $fields_to_move, 'IN') |
|
158 |
->execute(); |
|
159 |
|
|
160 |
db_delete('field_config_instance') |
|
161 |
->condition('entity_type', 'file') |
|
162 |
->condition('bundle', $bundle_old->type) |
|
163 |
->condition('field_name', $fields_to_drop, 'IN') |
|
164 |
->execute(); |
|
153 |
if (!empty($fields_to_move)) { |
|
154 |
db_update('field_config_instance') |
|
155 |
->fields(array('bundle' => $bundle_new->type)) |
|
156 |
->condition('entity_type', 'file') |
|
157 |
->condition('bundle', $bundle_old->type) |
|
158 |
->condition('field_name', $fields_to_move, 'IN') |
|
159 |
->execute(); |
|
160 |
} |
|
161 |
|
|
162 |
if (!empty($fields_to_drop)) { |
|
163 |
db_delete('field_config_instance') |
|
164 |
->condition('entity_type', 'file') |
|
165 |
->condition('bundle', $bundle_old->type) |
|
166 |
->condition('field_name', $fields_to_drop, 'IN') |
|
167 |
->execute(); |
|
168 |
} |
|
165 | 169 |
|
166 | 170 |
field_cache_clear(); |
167 | 171 |
module_invoke_all('field_attach_rename_bundle', 'file', $bundle_old->type, $bundle_new->type); |
Also available in: Unified diff
Weekly update of contrib modules