Commit 323c816d authored by joseph.olstad's avatar joseph.olstad Committed by joseph.olstad

Issue #3064895 by joseph.olstad: Code standards improvements 2x 3x 4x branches only

parent 7b63fbe2
......@@ -61,7 +61,7 @@ function media_migrate_file_types_upgrade_file_types($form, &$form_state) {
foreach ($migratable_types as $machine_name) {
$type = file_type_load($machine_name);
if (!$type) {
$type = new stdClass;
$type = new stdClass();
$type->label = $type->type = $machine_name;
}
$form['upgradable_types'][$machine_name] = array(
......@@ -137,7 +137,7 @@ function media_migrate_file_types_upgrade_file_types_confirm_submit($form, &$for
// Old bundle might be deleted so let's fake some values.
$bundle_old = file_type_load($type);
if (empty($bundle_old)) {
$bundle_old = new stdClass;
$bundle_old = new stdClass();
$bundle_old->type = $type;
$bundle_old->mimetypes = array();
$bundle_old->export_type = 2;
......@@ -145,15 +145,15 @@ function media_migrate_file_types_upgrade_file_types_confirm_submit($form, &$for
// Migrate fields to new bundle.
if ($_GET['migrate_fields']) {
$old_fields = db_select('field_config_instance', 'fc')->fields('fc', array('field_name'))->condition('entity_type', 'file')->condition('bundle', $bundle_old->type)->execute()->fetchCol();
$new_fields = db_select('field_config_instance', 'fc')->fields('fc', array('field_name'))->condition('entity_type', 'file')->condition('bundle', $bundle_new->type)->execute()->fetchCol();
$old_fields = db_select('field_config_instance', 'fc')->fields('fc', array('field_name'))->condition('entity_type', 'file')->condition('bundle', $bundle_old->type)->execute()->fetchCol();
$new_fields = db_select('field_config_instance', 'fc')->fields('fc', array('field_name'))->condition('entity_type', 'file')->condition('bundle', $bundle_new->type)->execute()->fetchCol();
$fields_to_move = array_diff($old_fields, $new_fields);
$fields_to_drop = array_diff($old_fields, $fields_to_move);
if (!empty($fields_to_move)) {
db_update('field_config_instance')
->fields(array('bundle' => $bundle_new->type))
->condition('entity_type', 'file')
->condition('entity_type', 'file')
->condition('bundle', $bundle_old->type)
->condition('field_name', $fields_to_move, 'IN')
->execute();
......@@ -161,7 +161,7 @@ function media_migrate_file_types_upgrade_file_types_confirm_submit($form, &$for
if (!empty($fields_to_drop)) {
db_delete('field_config_instance')
->condition('entity_type', 'file')
->condition('entity_type', 'file')
->condition('bundle', $bundle_old->type)
->condition('field_name', $fields_to_drop, 'IN')
->execute();
......
......@@ -5,8 +5,8 @@
* Primarily Drupal hooks.
*/
/*
* Implements hook_system_info_alter()
/**
* Implements hook_system_info_alter().
*/
function media_migrate_file_types_system_info_alter(&$info, $file, $type) {
if ($type == 'module' && $file->name == 'media_migrate_file_types') {
......@@ -52,8 +52,7 @@ function media_migrate_file_types_help($path, $arg) {
}
/**
* Checks if there are any files that belong to disabled or deleted file
* types.
* Checks if there are any files that belong to disabled or deleted file types.
*
* @return Array of file types (machine names) that are candidates for
* migration.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment