function updatedb_status

8.0.x update_6.inc updatedb_status()
8.0.x update.inc updatedb_status()
8.0.x update_7.inc updatedb_status()
6.x update_6.inc updatedb_status()
6.x update_7.inc updatedb_status()
7.x update_6.inc updatedb_status()
7.x update.inc updatedb_status()
7.x update_7.inc updatedb_status()
master update_7.inc updatedb_status()
master update.inc updatedb_status()

Return a 2 item array with

  • an array where each item is a 3 item associative array describing a pending update.
  • an array listing the first update to run, keyed by module.
3 calls to updatedb_status()
drush_core_updatedb_status in commands/core/core.drush.inc
Command handler. List pending DB updates.
update_main in commands/core/drupal/update_6.inc
update_main in commands/core/drupal/update_7.inc

File

commands/core/drupal/update.inc, line 245
Update.php for provisioned sites. This file is a derivative of the standard drupal update.php, which has been modified to allow being run from the command line.

Code

function updatedb_status() {
  $pending = update_get_update_list();

  $return = array();
  // Ensure system module's updates run first.
  $start['system'] = array();

  foreach (\Drupal::service('entity.definition_update_manager')->getChangeSummary() as $entity_type_id => $changes) {
    foreach ($changes as $change) {
      $return[] = array(
        'module' => dt('@type entity type', array('@type' => $entity_type_id)),
        'update_id' => '',
        'description' => strip_tags($change),
      );
    }
  }

  // Print a list of pending updates for this module and get confirmation.
  foreach ($pending as $module => $updates) {
    if (isset($updates['start'])) {
      foreach ($updates['pending'] as $update_id => $description) {
        // Strip cruft from front.
        $description = str_replace($update_id . ' -   ', '', $description);
        $return[] = array(
          'module' => ucfirst($module),
          'update_id' => $update_id,
          'description' => $description,
        );
      }
      if (isset($updates['start'])) {
        $start[$module] = $updates['start'];
      }
    }
  }

  return array($return, $start);
}