',
- 'cache' => -1,
- ));
- }
- drupal_set_message('The site mission was migrated to a custom block and set up to only show on the front page in the highlighted content region. The block was set to use the default text format, which might differ from the HTML based format used before. Check the block and ensure that the output is right. If your theme does not have a highlighted content region, you might need to relocate the block.');
- $insert->execute();
- // Migrate mission to RSS site description.
- variable_set('feed_description', $mission);
- }
-
- // Migrate site footer message to a custom block.
- if ($footer_message = variable_get('site_footer', '')) {
- $bid = db_insert('box')->fields(array('body' => $footer_message, 'info' => 'Footer message', 'format' => $default_format))->execute();
-
- $insert = db_insert('block')->fields(array('module', 'delta', 'theme', 'status', 'weight', 'region', 'pages', 'cache'));
- foreach ($themes_with_blocks as $theme) {
- // Add site footer block for themes, which had blocks.
- // Set low weight, so the block comes early (it used to be
- // before the other blocks).
- $insert->values(array(
- 'module' => 'block',
- 'delta' => $bid,
- 'theme' => $theme,
- 'status' => 1,
- 'weight' => -10,
- 'region' => 'footer',
- 'pages' => '',
- 'cache' => -1,
- ));
- }
- drupal_set_message('The footer message was migrated to a custom block and set up to appear in the footer. The block was set to use the default text format, which might differ from the HTML based format used before. Check the block and ensure that the output is right. If your theme does not have a footer region, you might need to relocate the block.');
- $insert->execute();
- }
-
- // Remove the variables (even if they were saved empty on the admin interface),
- // to avoid keeping clutter in the variables table.
- variable_del('contact_form_information');
- variable_del('user_registration_help');
- variable_del('site_mission');
- variable_del('site_footer');
-
- // Rebuild theme data, so the new 'help' region is identified.
- system_rebuild_theme_data();
-}
-
-/**
- * Add the queue tables.
- */
-function system_update_7022() {
- // Moved to update_fix_d7_requirements().
-}
-
/**
* Change the PHP for settings permission.
*/
-function system_update_7023() {
+function system_update_7021() {
db_update('role_permission')
->fields(array('permission' => 'use PHP for settings'))
->condition('permission', 'use PHP for block visibility')
@@ -2245,18 +2071,7 @@ function system_update_7027() {
module_enable($module_list, FALSE);
}
-/**
- * Rename taxonomy tables.
- */
-function system_update_7028() {
- db_rename_table('term_data', 'taxonomy_term_data');
- db_rename_table('term_hierarchy', 'taxonomy_term_hierarchy');
- db_rename_table('term_node', 'taxonomy_term_node');
- db_rename_table('term_relation', 'taxonomy_term_relation');
- db_rename_table('term_synonym', 'taxonomy_term_synonym');
- db_rename_table('vocabulary', 'taxonomy_vocabulary');
- db_rename_table('vocabulary_node_types', 'taxonomy_vocabulary_node_type');
-}
+// system_update_7028() moved to taxonomy_update_7001().
/**
* Add new 'view own unpublished content' permission for authenticated users.
@@ -2404,7 +2219,7 @@ function system_update_7035() {
// The old {files} tables still exists. We migrate core data from upload
// module, but any contrib module using it will need to do its own update.
- $result = db_query('SELECT fid, uid, filename, filepath AS uri, filemime, filesize, status, timestamp FROM {files} f INNER JOIN {upload} u ON u.fid = f.fid', array(), array('fetch' => PDO::FETCH_ASSOC));
+ $result = db_query('SELECT f.fid, uid, filename, filepath AS uri, filemime, filesize, status, timestamp FROM {files} f INNER JOIN {upload} u ON u.fid = f.fid', array(), array('fetch' => PDO::FETCH_ASSOC));
// We will convert filepaths to uri using the default schmeme
// and stripping off the existing file directory path.
@@ -2445,17 +2260,10 @@ function system_update_7036() {
variable_del('site_offline_message');
}
-/**
- * Rename {box} table to {block_custom}.
- */
-function system_update_7037() {
- db_rename_table('box', 'block_custom');
-}
-
/**
* Rename action description to label.
*/
-function system_update_7038() {
+function system_update_7037() {
db_change_field('actions', 'description', 'label', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '0'));
}
diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install
index a4408bb9342..d84797fcbc9 100644
--- a/modules/taxonomy/taxonomy.install
+++ b/modules/taxonomy/taxonomy.install
@@ -205,31 +205,60 @@ function taxonomy_schema() {
return $schema;
}
+/**
+ * Implements hook_update_dependencies().
+ */
+function taxonomy_update_dependencies() {
+ // Taxonomy update 7002 creates comment Field API bundles and therefore must
+ // run after the Field module has been enabled, but before upgrading field
+ // data.
+ $dependencies['taxonomy'][7002] = array(
+ 'system' => 7049,
+ );
+ $dependencies['system'][7050] = array(
+ 'taxonomy' => 7002,
+ );
+ // It also must run before nodes are upgraded to use the Field API.
+ $dependencies['node'][7006] = array(
+ 'taxonomy' => 7002,
+ );
+ return $dependencies;
+}
+
+/**
+ * Rename taxonomy tables.
+ */
+function taxonomy_update_7001() {
+ db_rename_table('term_data', 'taxonomy_term_data');
+ db_rename_table('term_hierarchy', 'taxonomy_term_hierarchy');
+ db_rename_table('term_node', 'taxonomy_term_node');
+ db_rename_table('term_relation', 'taxonomy_term_relation');
+ db_rename_table('term_synonym', 'taxonomy_term_synonym');
+ db_rename_table('vocabulary', 'taxonomy_vocabulary');
+ db_rename_table('vocabulary_node_types', 'taxonomy_vocabulary_node_type');
+}
+
/**
* Add {vocabulary}.machine_name column.
*/
function taxonomy_update_7002() {
- if (!variable_get('taxonomy_update_7002_done', FALSE)) {
- $field = array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'The vocabulary machine name.',
- );
+ $field = array(
+ 'type' => 'varchar',
+ 'length' => 255,
+ 'not null' => TRUE,
+ 'default' => '',
+ 'description' => 'The vocabulary machine name.',
+ );
- db_add_field('taxonomy_vocabulary', 'machine_name', $field);
+ db_add_field('taxonomy_vocabulary', 'machine_name', $field);
- foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
- $machine_name = 'vocabulary_' . $vid;
- db_update('taxonomy_vocabulary')
- ->fields(array('machine_name' => 'vocabulary_' . $vid))
- ->condition('vid', $vid)
- ->execute();
- field_attach_create_bundle('taxonomy_term', $machine_name);
- }
-
- variable_set('taxonomy_update_7002_done', TRUE);
+ foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
+ $machine_name = 'vocabulary_' . $vid;
+ db_update('taxonomy_vocabulary')
+ ->fields(array('machine_name' => 'vocabulary_' . $vid))
+ ->condition('vid', $vid)
+ ->execute();
+ field_attach_create_bundle('taxonomy_term', $machine_name);
}
}
diff --git a/update.php b/update.php
index 7ad82f5838e..5c01ea92e0c 100644
--- a/update.php
+++ b/update.php
@@ -39,6 +39,7 @@ function update_selection_page() {
function update_script_selection_form($form, &$form_state) {
$count = 0;
+ $incompatible_count = 0;
$form['start'] = array(
'#tree' => TRUE,
'#type' => 'fieldset',
@@ -50,6 +51,8 @@ function update_script_selection_form($form, &$form_state) {
$form['start']['system'] = array();
$updates = update_get_update_list();
+ $starting_updates = array();
+ $incompatible_updates_exist = FALSE;
foreach ($updates as $module => $update) {
if (!isset($update['start'])) {
$form['start'][$module] = array(
@@ -58,15 +61,19 @@ function update_script_selection_form($form, &$form_state) {
'#prefix' => '',
'#suffix' => '
',
);
+ $incompatible_updates_exist = TRUE;
continue;
}
if (!empty($update['pending'])) {
+ $starting_updates[$module] = $update['start'];
$form['start'][$module] = array(
'#type' => 'hidden',
'#value' => $update['start'],
);
$form['start'][$module . '_updates'] = array(
- '#markup' => theme('item_list', array('items' => $update['pending'], 'title' => $module . ' module')),
+ '#theme' => 'item_list',
+ '#items' => $update['pending'],
+ '#title' => $module . ' module',
);
}
if (isset($update['pending'])) {
@@ -74,6 +81,26 @@ function update_script_selection_form($form, &$form_state) {
}
}
+ // Find and label any incompatible updates.
+ foreach (update_resolve_dependencies($starting_updates) as $function => $data) {
+ if (!$data['allowed']) {
+ $incompatible_updates_exist = TRUE;
+ $incompatible_count++;
+ $module_update_key = $data['module'] . '_updates';
+ if (isset($form['start'][$module_update_key]['#items'][$data['number']])) {
+ $text = $data['missing_dependencies'] ? 'This update will been skipped due to the following missing dependencies: ' . implode(', ', $data['missing_dependencies']) . '' : "This update will be skipped due to an error in the module's code.";
+ $form['start'][$module_update_key]['#items'][$data['number']] .= '' . $text . '
';
+ }
+ // Move the module containing this update to the top of the list.
+ $form['start'] = array($module_update_key => $form['start'][$module_update_key]) + $form['start'];
+ }
+ }
+
+ // Warn the user if any updates were incompatible.
+ if ($incompatible_updates_exist) {
+ drupal_set_message('Some of the pending updates cannot be applied because their dependencies were not met.', 'warning');
+ }
+
if (empty($count)) {
drupal_set_message(t('No pending updates.'));
unset($form);
@@ -86,7 +113,17 @@ function update_script_selection_form($form, &$form_state) {
'#markup' => 'The version of Drupal you are updating from has been automatically detected.
',
'#weight' => -5,
);
- $form['start']['#title'] = format_plural($count, '1 pending update', '@count pending updates');
+ if ($incompatible_count) {
+ $form['start']['#title'] = format_plural(
+ $count,
+ '1 pending update (@number_applied to be applied, @number_incompatible skipped)',
+ '@count pending updates (@number_applied to be applied, @number_incompatible skipped)',
+ array('@number_applied' => $count - $incompatible_count, '@number_incompatible' => $incompatible_count)
+ );
+ }
+ else {
+ $form['start']['#title'] = format_plural($count, '1 pending update', '@count pending updates');
+ }
$form['has_js'] = array(
'#type' => 'hidden',
'#default_value' => FALSE,
@@ -142,9 +179,9 @@ function update_results_page() {
$output .= '';
$output .= '
The following updates returned messages
';
foreach ($_SESSION['update_results'] as $module => $updates) {
- $output .= '' . $module . ' module
';
- foreach ($updates as $number => $queries) {
- if ($number != '#abort') {
+ if ($module != '#abort') {
+ $output .= '' . $module . ' module
';
+ foreach ($updates as $number => $queries) {
$messages = array();
foreach ($queries as $query) {
// If there is no message for this update, don't show anything.