You are here

function thunder_update_dependencies in Thunder 8.5

Same name and namespace in other branches
  1. 8.2 thunder.install \thunder_update_dependencies()
  2. 8.3 thunder.install \thunder_update_dependencies()
  3. 8.4 thunder.install \thunder_update_dependencies()
  4. 6.2.x thunder.install \thunder_update_dependencies()
  5. 6.0.x thunder.install \thunder_update_dependencies()
  6. 6.1.x thunder.install \thunder_update_dependencies()

Update hook dependencies.

Ensure that Thunder updates come last so entity schema updates and more fundamental updates occur first.

Return value

mixed Returns list of update hook dependencies.

File

./thunder.install, line 22
Install, update and uninstall functions for the thunder installation profile.

Code

function thunder_update_dependencies() {
  $dependencies['thunder'] = [];

  // Ensure that all thunder hook_update_N functions are called after all other
  // update hooks.
  $list = [];
  $return = [];
  $updates = update_get_update_list();

  // List of thunder modules with hook_update_N() functions.
  $thunder_module_list = [
    'thunder',
    'thunder_article',
    'thunder_liveblog',
    'thunder_media',
    'thunder_paragraphs',
    'thunder_taxonomy',
    'thunder_translation',
    'thunder_password_policy',
    'thunder_google_analytics',
    'thunder_translation',
    'thunder_workflow',
    'thunder_ivw',
    'thunder_riddle',
    'thunder_search',
  ];
  foreach ($updates as $module => $info) {
    if (in_array($module, $thunder_module_list, TRUE)) {

      // Build a list of thunder modules with updates to run.
      $return[$module] = [];
    }
    else {

      // Build the list of all the update hooks for thunder updates to depend
      // on.
      $pending = array_keys($info['pending']);
      $list[$module] = array_pop($pending);
    }
  }

  // Add the dependencies to the thunder modules with updates to run.
  foreach ($return as $module => &$info) {
    $info[$updates[$module]['start']] = $list;
  }
  return NestedArray::mergeDeepArray([
    $return,
    $dependencies,
  ], TRUE);
}