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_6.inc, line 376
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() {
  update_main_prepare();

  list($pending, $start) = updatedb_status();

  // Print a list of pending updates for this module and get confirmation.
  if ($pending) {
    // @todo get table header working
    // array_unshift($pending, array(dt('Module'), dt('ID'), dt('Description')));
    drush_print_table($pending, FALSE);
    if (!drush_confirm(dt('Do you wish to run all pending updates?'))) {
      return drush_user_abort();
    }
    // Proceed with running all pending updates.
    $operations = array();
    foreach ($start as $module => $version) {
      drupal_set_installed_schema_version($module, $version - 1);
      $updates = drupal_get_schema_versions($module);
      $max_version = max($updates);
      if ($version <= $max_version) {
        drush_log(dt('Updating module @module from schema version @start to schema version @max', array('@module' => $module, '@start' => $version - 1, '@max' => $max_version)));
        foreach ($updates as $update) {
          if ($update >= $version) {
            $operations[] = array('_update_do_one', array($module, $update));
          }
        }
      }
      else {
        drush_log(dt('No database updates for module @module', array('@module' => $module)), 'success');
      }
    }
    $batch = array(
      'operations' => $operations,
      'title' => 'Updating',
      'init_message' => 'Starting updates',
      'error_message' => 'An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference.',
      'finished' => 'update_finished',
    );
    batch_set($batch);
    $batch = &batch_get();
    $batch['progressive'] = FALSE;
    drush_backend_batch_process('updatedb-batch-process');
  }
  else {
    drush_log(dt("No database updates required"), 'success');
  }
}