Problem/Motivation

hook_update_dependencies() declares dependencies between hook_update_N() implementations.

function hook_update_dependencies() {
  $dependencies['mymodule'][8001] = [
    'another_module' => 8003,
  ];
  $dependencies['yet_another_module'][8005] = [
    'mymodule' => 8002,
  ];
}

This is sub optimal because the dependencies are disconnected from the update hooks themselves.

Steps to reproduce

Proposed resolution

Convert hook_update_dependencies() to PHP attributes:

#[RunAfter('another_module_update_8003')]
function mymodule_update_8001() {
}

#[RunBefore('yet_another_module_update_8005')]
function mymodule_update_8002() {
}

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

longwave created an issue. See original summary.

longwave’s picture

Issue summary: View changes
longwave’s picture

Component: extension system » database update system

Version: 10.0.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.