You are here

function drd_server_domain_find_required_updates in Drupal Remote Dashboard Server 6

Same name and namespace in other branches
  1. 6.2 drd_server.domain.inc \drd_server_domain_find_required_updates()
  2. 7.2 drd_server.domain.inc \drd_server_domain_find_required_updates()
  3. 7 drd_server.domain.inc \drd_server_domain_find_required_updates()
1 string reference to 'drd_server_domain_find_required_updates'
drd_server_domain_run_update in ./drd_server.domain.inc

File

./drd_server.domain.inc, line 135

Code

function drd_server_domain_find_required_updates() {
  drupal_get_messages();
  $form = update_script_selection_form();
  $operations = array();
  foreach ($form['start'] as $module => $def) {
    if (isset($def['#default_value'])) {
      $version = $def['#default_value'];
      drupal_set_installed_schema_version($module, $version - 1);
      $updates = drupal_get_schema_versions($module);
      if ($updates) {
        $max_version = max($updates);
        if ($version <= $max_version) {
          foreach ($updates as $update) {
            if ($update >= $version) {
              $operations[] = array(
                'update_do_one',
                array(
                  $module,
                  $update,
                ),
              );
              watchdog('DRD', 'Updating ' . $module . ': version ' . $update);
              drupal_set_message('Updating ' . $module . ': version ' . $update);
            }
          }
        }
      }
    }
  }
  $operations[] = array(
    'drd_server_domain_capture_update_messages',
    array(),
  );
  $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.',
  );
  batch_set($batch);
}