function update_main

8.0.x update_6.inc update_main()
8.0.x update.inc update_main()
8.0.x update_7.inc update_main()
6.x update_6.inc update_main()
6.x update.inc update_main()
6.x update_7.inc update_main()
7.x update_6.inc update_main()
7.x update.inc update_main()
7.x update_7.inc update_main()
3.x update_6.inc update_main()
3.x update_5.inc update_main()
3.x update_7.inc update_main()
4.x update_6.inc update_main()
4.x update.inc update_main()
4.x update_5.inc update_main()
5.x update_6.inc update_main()
5.x update.inc update_main()
5.x update_7.inc update_main()
master update.inc update_main()
master update_7.inc update_main()
1 call to update_main()
drush_core_updatedb in commands/core/core.drush.inc
Command handler. Execute update.php code from drush.

File

commands/core/drupal/update.inc, line 105
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 update_main() {
  // In D8, we expect to be in full bootstrap.
  drush_bootstrap_to_phase(DRUSH_BOOTSTRAP_DRUPAL_FULL);

  require_once DRUPAL_ROOT . '/core/includes/install.inc';
  require_once DRUPAL_ROOT . '/core/includes/update.inc';
  drupal_load_updates();
  update_fix_compatibility();

  // Pending hook_update_N() implementations.
  $pending = update_get_update_list();

  // Pending hook_post_update_X() implementations.
  $post_updates = \Drupal::service('update.post_update_registry')->getPendingUpdateInformation();

  $start = array();

  $change_summary =[];
  if (drush_get_option('entity-updates', FALSE)) {
    $change_summary = \Drupal::entityDefinitionUpdateManager()->getChangeSummary();
  }

  // Print a list of pending updates for this module and get confirmation.
  if (count($pending) || $change_summary || count($post_updates)) {
    drush_print(dt('The following updates are pending:'));
    drush_print();

    foreach ($change_summary as $entity_type_id => $changes) {
      drush_print($entity_type_id . ' entity type : ');
      foreach ($changes as $change) {
        drush_print(strip_tags($change), 2);
      }
    }

    foreach (array('update', 'post_update') as $update_type) {
      $updates = $update_type == 'update' ? $pending : $post_updates;
      foreach ($updates as $module => $updates) {
        if (isset($updates['start'])) {
          drush_print($module . ' module : ');
          if (!empty($updates['pending'])) {
            $start +=[$module array()];

            $start[$module] = array_merge($start[$module], $updates['pending']);
            foreach ($updates['pending'] as $update) {
              drush_print(strip_tags($update), 2);
            }
          }
          drush_print();
        }
      }
    }

    if (!drush_confirm(dt('Do you wish to run all pending updates?'))) {
      return drush_user_abort();
    }

    drush_update_batch($start);
  }
  else {
    drush_log(dt("No database updates required"), LogLevel::SUCCESS);
  }
}