diff --git a/includes/update.inc b/includes/update.inc index 1eb7a1d..7cd79d7 100644 --- a/includes/update.inc +++ b/includes/update.inc @@ -748,6 +748,9 @@ function update_fix_d7_requirements() { // Rename action description to label. db_change_field('actions', 'description', 'label', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '0')); + // Include updates of new core modules. + update_fix_new_modules(); + variable_set('update_d7_requirements', TRUE); } @@ -755,6 +758,34 @@ function update_fix_d7_requirements() { } /** + * Prepares system records of new core modules to include their updates. + * + * In order to have module updates from newly added core modules picked up + * during a major version upgrade, their schema_version needs to be changed from + * SCHEMA_UNINSTALLED to 0 (unless they existed in the previous version + * already), since only updates of installed modules are ran. + * + * This cannot be done during execution of updates, since we need to calculate + * update dependencies. Without this adjustment, only module updates being + * required by other modules would be executed. + * + * Lastly, each of these modules should have an accompanying + * MODULE_schema_7000() implementation of hook_schema(), which specifies the + * original schema at the time of upgrading, in case the module has later + * updates that are changing the schema. The module update that enables the + * module MUST NOT use module_enable() to install the module. + */ +function update_fix_new_modules() { + $module_list = array('field_sql_storage', 'field', 'field_ui', 'text', 'number', 'list', 'options'); + db_update('system') + ->condition('type', 'module') + ->condition('name', $module_list, 'IN') + ->condition('schema_version', SCHEMA_UNINSTALLED) + ->fields(array('schema_version' => 0)) + ->execute(); +} + +/** * Register the currently installed profile in the system table. * * Install profiles are now treated as modules by Drupal, and have an upgrade diff --git a/modules/system/system.install b/modules/system/system.install index e55c7cf..2babb2b 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -2071,8 +2071,15 @@ function system_update_7018() { /** * Enable field and field_ui modules. + * + * @see update_fix_new_modules() */ function system_update_7020() { + $schema = array(); + $schema += field_schema_7000(); + foreach ($schema as $table => $spec) { + db_create_table($table, $spec); + } $module_list = array('field_sql_storage', 'field', 'field_ui'); module_enable($module_list, FALSE); } @@ -2089,6 +2096,8 @@ function system_update_7021() { /** * Enable field type modules. + * + * @see update_fix_new_modules() */ function system_update_7027() { $module_list = array('text', 'number', 'list', 'options');