From e1c40673b9c7b3470321b10a46f91cd92fc91b93 Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Mon, 2 Sep 2013 22:29:44 +0100 Subject: [PATCH] Issue #2078837 by alexpott: Fixed Ensure that we are using SQL storage for taxonomy_update_8007(). --- core/modules/file/file.install | 52 +++++++++++++------------- core/modules/taxonomy/taxonomy.install | 44 +++++++++++----------- 2 files changed, 50 insertions(+), 46 deletions(-) diff --git a/core/modules/file/file.install b/core/modules/file/file.install index ab17ad8933c1..2a958ebbfd99 100644 --- a/core/modules/file/file.install +++ b/core/modules/file/file.install @@ -309,35 +309,37 @@ function file_update_8003() { if (in_array($field_config->get('type'), array('file', 'image'))) { $field = new Field($field_config->get()); - $tables = array( - DatabaseStorageController::_fieldTableName($field), - DatabaseStorageController::_fieldRevisionTableName($field), - ); + if (db_table_exists(DatabaseStorageController::_fieldTableName($field))) { + $tables = array( + DatabaseStorageController::_fieldTableName($field), + DatabaseStorageController::_fieldRevisionTableName($field), + ); - foreach ($tables as $table_name) { - // Skip fields which were created during the upgrade process. - if (!db_field_exists($table_name, $field->name . '_fid')) { - continue 2; - } + foreach ($tables as $table_name) { + // Skip fields which were created during the upgrade process. + if (!db_field_exists($table_name, $field->name . '_fid')) { + continue 2; + } - db_change_field($table_name, $field->name . '_fid', $field->name . '_target_id', array( - 'description' => 'The ID of the target entity.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - )); + db_change_field($table_name, $field->name . '_fid', $field->name . '_target_id', array( + 'description' => 'The ID of the target entity.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + )); - // Change the index. - db_drop_index($table_name, $field->name . '_fid'); - db_add_index($table_name, $field->name . '_target_id', array($field->name . '_target_id')); - } + // Change the index. + db_drop_index($table_name, $field->name . '_fid'); + db_add_index($table_name, $field->name . '_target_id', array($field->name . '_target_id')); + } - // Update the indexes in field config as well. - $indexes = $field_config->get('indexes'); - unset($indexes['fid']); - $indexes['target_id'] = array('target_id'); - $field_config->set('indexes', $indexes); - $field_config->save(); + // Update the indexes in field config as well. + $indexes = $field_config->get('indexes'); + unset($indexes['fid']); + $indexes['target_id'] = array('target_id'); + $field_config->set('indexes', $indexes); + $field_config->save(); + } } } } diff --git a/core/modules/taxonomy/taxonomy.install b/core/modules/taxonomy/taxonomy.install index 39835d6942af..875fbca3317b 100644 --- a/core/modules/taxonomy/taxonomy.install +++ b/core/modules/taxonomy/taxonomy.install @@ -364,30 +364,32 @@ function taxonomy_update_8007() { if ($field_config->get('type') == 'taxonomy_term_reference') { $field = new Field($field_config->get()); - $tables = array( - DatabaseStorageController::_fieldTableName($field), - DatabaseStorageController::_fieldRevisionTableName($field), - ); + if (db_table_exists(DatabaseStorageController::_fieldTableName($field))) { + $tables = array( + DatabaseStorageController::_fieldTableName($field), + DatabaseStorageController::_fieldRevisionTableName($field), + ); - foreach ($tables as $table_name) { - db_change_field($table_name, $field->name . '_tid', $field->name . '_target_id', array( - 'description' => 'The ID of the target entity.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => FALSE, - )); + foreach ($tables as $table_name) { + db_change_field($table_name, $field->name . '_tid', $field->name . '_target_id', array( + 'description' => 'The ID of the target entity.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => FALSE, + )); - // Change the index. - db_drop_index($table_name, $field->name . '_tid'); - db_add_index($table_name, $field->name . '_target_id', array($field->name . '_target_id')); - } + // Change the index. + db_drop_index($table_name, $field->name . '_tid'); + db_add_index($table_name, $field->name . '_target_id', array($field->name . '_target_id')); + } - // Update the indexes in field config as well. - $indexes = $field_config->get('indexes'); - unset($indexes['tid']); - $indexes['target_id'] = array('target_id'); - $field_config->set('indexes', $indexes); - $field_config->save(); + // Update the indexes in field config as well. + $indexes = $field_config->get('indexes'); + unset($indexes['tid']); + $indexes['target_id'] = array('target_id'); + $field_config->set('indexes', $indexes); + $field_config->save(); + } } } } -- GitLab