From 1e48014398e19d334bb0b6e5ac517265b575a6f4 Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Sat, 6 Aug 2011 16:29:31 -0700 Subject: [PATCH] Issue #717834 by David_Rothstein, clemens.tolboom, catch: Fixed The dependencies declared in core's hook_update_dependencies() implementations aren't actually correct. --- modules/block/block.install | 10 +++---- modules/comment/comment.install | 12 +++++---- modules/field/modules/text/text.install | 13 --------- modules/filter/filter.install | 5 ++-- modules/node/node.install | 20 +++++++++----- modules/system/system.install | 13 ++++++--- modules/taxonomy/taxonomy.install | 25 ++++-------------- modules/user/user.install | 35 +++++++++++++++---------- 8 files changed, 61 insertions(+), 72 deletions(-) diff --git a/modules/block/block.install b/modules/block/block.install index c45b076bf75f..b2ab477d9093 100644 --- a/modules/block/block.install +++ b/modules/block/block.install @@ -190,16 +190,12 @@ function block_install() { * Implements hook_update_dependencies(). */ function block_update_dependencies() { - // Block update 7005 needs to query the list of existing text formats and - // therefore must run after filter_update_7000(). + // block_update_7005() needs to query the {filter_format} table to get a list + // of existing text formats, so it must run after filter_update_7000(), which + // creates that table. $dependencies['block'][7005] = array( 'filter' => 7000, ); - // Ensure that format columns are only changed after Filter module has changed - // the primary records. - $dependencies['block'][7007] = array( - 'filter' => 7010, - ); return $dependencies; } diff --git a/modules/comment/comment.install b/modules/comment/comment.install index 120467fd0594..cda3c308d5f4 100644 --- a/modules/comment/comment.install +++ b/modules/comment/comment.install @@ -83,14 +83,16 @@ function comment_modules_enabled($modules) { * Implements hook_update_dependencies(). */ function comment_update_dependencies() { - // Comment update 7005 creates the comment body field and therefore must run - // after text module has been enabled and entities have been updated. + // comment_update_7005() creates the comment body field and therefore must + // run after all Field modules have been enabled, which happens in + // system_update_7027(). $dependencies['comment'][7005] = array( - 'system' => 7021, + 'system' => 7027, ); - // Comment update 7006 needs to query the list of existing text formats and - // therefore must run after filter_update_7000(). + // comment_update_7006() needs to query the {filter_format} table to get a + // list of existing text formats, so it must run after filter_update_7000(), + // which creates that table. $dependencies['comment'][7006] = array( 'filter' => 7000, ); diff --git a/modules/field/modules/text/text.install b/modules/field/modules/text/text.install index b9bd25f19932..61be748ac405 100644 --- a/modules/field/modules/text/text.install +++ b/modules/field/modules/text/text.install @@ -66,19 +66,6 @@ function text_field_schema($field) { ); } -/** - * Implements hook_update_dependencies(). - */ -function text_update_dependencies() { - // Ensure that format columns are only changed after Filter module has changed - // the primary records. - $dependencies['text'][7000] = array( - 'filter' => 7010, - ); - - return $dependencies; -} - /** * Change text field 'format' columns into varchar. */ diff --git a/modules/filter/filter.install b/modules/filter/filter.install index 84512cd589f4..19fd8aa18297 100644 --- a/modules/filter/filter.install +++ b/modules/filter/filter.install @@ -152,8 +152,9 @@ function filter_install() { * Implements hook_update_dependencies(). */ function filter_update_dependencies() { - // Filter update 7007 migrates permissions and therefore needs to run after - // the {role} table is properly set up. + // filter_update_7005() migrates role permissions and therefore must run + // after the {role} and {role_permission} tables are properly set up, which + // happens in user_update_7007(). $dependencies['filter'][7005] = array( 'user' => 7007, ); diff --git a/modules/node/node.install b/modules/node/node.install index 2498091fc533..d33f095f07cf 100644 --- a/modules/node/node.install +++ b/modules/node/node.install @@ -447,17 +447,23 @@ function node_install() { * Implements hook_update_dependencies(). */ function node_update_dependencies() { - // Node update 7006 migrates node data to fields and therefore must run after - // the Field module has been enabled, but before upgrading field data. + // node_update_7006() migrates node data to fields and therefore must run + // after all Field modules have been enabled, which happens in + // system_update_7027(). It also needs to query the {filter_format} table to + // get a list of existing text formats, so it must run after + // filter_update_7000(), which creates that table. $dependencies['node'][7006] = array( - 'system' => 7049, - // It must also run after filter_update_7000() because it needs to query - // the list of existing text formats. + 'system' => 7027, 'filter' => 7000, ); - $dependencies['system'][7050] = array( - 'node' => 7006, + + // node_update_7008() migrates role permissions and therefore must run after + // the {role} and {role_permission} tables are properly set up, which happens + // in user_update_7007(). + $dependencies['node'][7008] = array( + 'user' => 7007, ); + return $dependencies; } diff --git a/modules/system/system.install b/modules/system/system.install index e55c7cf3aa7e..6cbbb9ed018c 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -1681,11 +1681,19 @@ function system_update_last_removed() { * Implements hook_update_dependencies(). */ function system_update_dependencies() { - // Update 7053 adds new blocks, so make sure the block tables are updated. + // system_update_7053() queries the {block} table, so it must run after + // block_update_7002(), which creates that table. $dependencies['system'][7053] = array( 'block' => 7002, ); + // system_update_7067() migrates role permissions and therefore must run + // after the {role} and {role_permission} tables are properly set up, which + // happens in user_update_7007(). + $dependencies['system'][7067] = array( + 'user' => 7007, + ); + return $dependencies; } @@ -1866,9 +1874,6 @@ function system_update_7005() { /** * Convert to new method of storing permissions. - * - * This update is in system.install rather than user.install so that - * all modules can use the updated permission scheme during their updates. */ function system_update_7007() { // Copy the permissions from the old {permission} table to the new {role_permission} table. diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install index 68fbc7804a99..f442c95ef175 100644 --- a/modules/taxonomy/taxonomy.install +++ b/modules/taxonomy/taxonomy.install @@ -251,26 +251,11 @@ function taxonomy_field_schema($field) { * 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['user'][7006] = array( - 'taxonomy' => 7002, - ); - $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, - ); - // Ensure that format columns are only changed after Filter module has changed - // the primary records. - $dependencies['taxonomy'][7009] = array( - 'filter' => 7010, + // taxonomy_update_7004() migrates taxonomy term data to fields and therefore + // must run after all Field modules have been enabled, which happens in + // system_update_7027(). + $dependencies['taxonomy'][7004] = array( + 'system' => 7027, ); return $dependencies; diff --git a/modules/user/user.install b/modules/user/user.install index 75fca659014f..2867b97ed2c0 100644 --- a/modules/user/user.install +++ b/modules/user/user.install @@ -340,25 +340,32 @@ function user_install() { * Implements hook_update_dependencies(). */ function user_update_dependencies() { - // Run all the critical user upgrades before everything. - $dependencies['system'][7000] = array( - 'user' => 7008, - ); - // Both user_update_7006() and user_update_7010() need to query the list of - // existing text formats and therefore must run after filter_update_7003(). - // @todo: move user_update_7006 down below in the upgrade process. + // user_update_7006() updates data in the {role_permission} table, so it must + // run after system_update_7007(), which populates that table. $dependencies['user'][7006] = array( - 'filter' => 7003, + 'system' => 7007, + ); + + // user_update_7010() needs to query the {filter_format} table to get a list + // of existing text formats, so it must run after filter_update_7000(), which + // creates that table. + $dependencies['user'][7010] = array( + 'filter' => 7000, ); - // user_update_7013 relies on system_update_7060. + + // user_update_7012() uses the file API, which relies on the {file_managed} + // table, so it must run after system_update_7034(), which creates that + // table. + $dependencies['user'][7012] = array( + 'system' => 7034, + ); + + // user_update_7013() uses the file usage API, which relies on the + // {file_usage} table, so it must run after system_update_7059(), which + // creates that table. $dependencies['user'][7013] = array( 'system' => 7059, ); - // Ensure that format columns are only changed after Filter module has changed - // the primary records. - $dependencies['user'][7015] = array( - 'filter' => 7010, - ); return $dependencies; } -- GitLab