You are here

function update_data in Drupal 5

Same name and namespace in other branches
  1. 4 update.php \update_data()

Perform one update and store the results which will later be displayed on the finished page.

Parameters

$module: The module whose update will be run.

$number: The update number to run.

Return value

TRUE if the update was finished. Otherwise, FALSE.

1 call to update_data()
update_do_updates in ./update.php
Perform updates for one second or until finished.

File

./update.php, line 289
Administrative page for handling updates from one Drupal version to another.

Code

function update_data($module, $number) {
  $ret = module_invoke($module, 'update_' . $number);

  // Assume the update finished unless the update results indicate otherwise.
  $finished = 1;
  if (isset($ret['#finished'])) {
    $finished = $ret['#finished'];
    unset($ret['#finished']);
  }

  // Save the query and results for display by update_finished_page().
  if (!isset($_SESSION['update_results'])) {
    $_SESSION['update_results'] = array();
  }
  if (!isset($_SESSION['update_results'][$module])) {
    $_SESSION['update_results'][$module] = array();
  }
  if (!isset($_SESSION['update_results'][$module][$number])) {
    $_SESSION['update_results'][$module][$number] = array();
  }
  $_SESSION['update_results'][$module][$number] = array_merge($_SESSION['update_results'][$module][$number], $ret);
  if ($finished == 1) {

    // Update the installed version
    drupal_set_installed_schema_version($module, $number);
  }
  return $finished;
}