5

I'm watching a Drupal 6 to 7 upgrade run, wondering at the order these updates are called.

Aside from being in numeric order per each module, it seems that the module updates have been combined and I can't discern the pattern. Why does the system stop at system_update_7027 and resume at system_update_7029 after firing updates from several other modules in between?

    Performed update: system_update_7015                  [ok]
    Performed update: system_update_7016                  [ok]
    Performed update: system_update_7017                  [ok]
    Performed update: system_update_7018                  [ok]
    Performed update: system_update_7020                  [ok]
    Performed update: system_update_7021                  [ok]
    Performed update: system_update_7027                  [ok]
    Performed update: taxonomy_update_7004                [ok]
    Performed update: taxonomy_update_7005                [ok]
    Performed update: taxonomy_update_7005                [ok]
    Performed update: taxonomy_update_7005                [ok]
    Performed update: taxonomy_update_7005                [ok]
    Performed update: taxonomy_update_7006                [ok]
    Performed update: taxonomy_update_7007                [ok]
    Performed update: taxonomy_update_7008                [ok]
    Performed update: taxonomy_update_7009                [ok]
    Performed update: taxonomy_update_7010                [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7006                    [ok]
    Performed update: node_update_7007                    [ok]
    Performed update: node_update_7008                    [ok]
    Performed update: node_update_7009                    [ok]
    Performed update: node_update_7010                    [ok]
    Performed update: node_update_7011                    [ok]
    Performed update: node_update_7012                    [ok]
    Performed update: node_update_7013                    [ok]
    Performed update: comment_update_7005                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7006                 [ok]
    Performed update: comment_update_7007                 [ok]
    Performed update: comment_update_7008                 [ok]
    Performed update: comment_update_7009                 [ok]
    Performed update: system_update_7029                  [ok]
    Performed update: system_update_7032                  [ok]
    Performed update: system_update_7033                  [ok]
    Performed update: system_update_7034                  [ok]
    Performed update: user_update_7012                    [ok]
    Performed update: system_update_7036                  [ok]
    Performed update: system_update_7042                  [ok]
    Performed update: system_update_7044                  [ok]
    Performed update: system_update_7045                  [ok]
    Performed update: system_update_7046                  [ok]
    Performed update: system_update_7047                  [ok]
    Performed update: system_update_7048                  [ok]
    Performed update: system_update_7049                  [ok]
    Performed update: system_update_7050                  [ok]
    Performed update: system_update_7051                  [ok]
    Performed update: system_update_7052                  [ok]
    Performed update: system_update_7053                  [ok]
    Performed update: system_update_7054                  [ok]
    Performed update: system_update_7055                  [ok]
    Performed update: system_update_7057                  [ok]
    Performed update: system_update_7058                  [ok]
    Performed update: system_update_7059                  [ok]
    Performed update: user_update_7013                    [ok]
    Performed update: user_update_7014                    [ok]
    Performed update: user_update_7015                    [ok]
    Performed update: webform_update_7301                 [ok]
    Performed update: user_update_7016                    [ok]
    Performed update: mollom_update_7000                  [ok]
    Performed update: user_update_7017                    [ok]
    Performed update: webform_update_7302                 [ok]
    Performed update: mollom_update_7001                  [ok]
    Performed update: user_update_7018                    [ok]
    Performed update: webform_update_7303                 [ok]
    Performed update: webform_update_7304                 [ok]
    Performed update: system_update_7060                  [ok]
    Performed update: mollom_update_7002                  [ok]
    Performed update: system_update_7061                  [ok]
    Performed update: apachesolr_update_7000                                                                                                                                            [ok]
    Performed update: mollom_update_7003                  [ok]
    Performed update: webform_update_7305                 [ok]
  • When running these updates, there is time to ponder such things :) – Chris Burgess Jan 24 '13 at 2:07
6

The order in which updates are executed is influenced by hook_update_dependencies(), which is described as:

This can be used to indicate update functions from other modules that your module's update functions depend on, or vice versa. It is used by the update system to determine the appropriate order in which updates should be run, as well as to search for missing dependencies.

For example, the implementation done from the Node module is the following one.

function node_update_dependencies() {
  // 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' => 7027, 
    'filter' => 7000,
  );

  // 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;
}

That code is telling to Drupal that node_update_7006() is executed after system_update_7027() is executed, which is what you notice. Similarly, taxonomy_update_dependencies() tells Drupal that taxonomy_update_7004() needs to be executed after system_update_7027().

The function that handles the dependencies between update hooks is update_resolve_dependencies().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.