You are here

function update_finished_page in Drupal 5

Same name and namespace in other branches
  1. 4 update.php \update_finished_page()
1 call to update_finished_page()
update.php in ./update.php
Administrative page for handling updates from one Drupal version to another.

File

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

Code

function update_finished_page($success) {
  drupal_set_title('Drupal database update');

  // NOTE: we can't use l() here because the URL would point to 'update.php?q=admin'.
  $links[] = '<a href="' . base_path() . '">Main page</a>';
  $links[] = '<a href="' . base_path() . '?q=admin">Administration pages</a>';

  // Report end result
  if ($success) {
    $output = '<p>Updates were attempted. If you see no failures below, you may proceed happily to the <a href="index.php?q=admin">administration pages</a>. Otherwise, you may need to update your database manually. All errors have been <a href="index.php?q=admin/logs/watchdog">logged</a>.</p>';
  }
  else {
    $update = reset($_SESSION['update_remaining']);
    $output = '<p class="error">The update process was aborted prematurely while running <strong>update #' . $update['version'] . ' in ' . $update['module'] . '.module</strong>. All other errors have been <a href="index.php?q=admin/logs/watchdog">logged</a>. You may need to check the <code>watchdog</code> database table manually.</p>';
  }
  if ($GLOBALS['access_check'] == FALSE) {
    $output .= "<p><strong>Reminder: don't forget to set the <code>\$access_check</code> value at the top of <code>update.php</code> back to <code>TRUE</code>.</strong></p>";
  }
  $output .= theme('item_list', $links);

  // Output a list of queries executed
  if (!empty($_SESSION['update_results'])) {
    $output .= '<div id="update-results">';
    $output .= '<h2>The following queries were executed</h2>';
    foreach ($_SESSION['update_results'] as $module => $updates) {
      $output .= '<h3>' . $module . ' module</h3>';
      foreach ($updates as $number => $queries) {
        $output .= '<h4>Update #' . $number . '</h4>';
        $output .= '<ul>';
        foreach ($queries as $query) {
          if ($query['success']) {
            $output .= '<li class="success">' . $query['query'] . '</li>';
          }
          else {
            $output .= '<li class="failure"><strong>Failed:</strong> ' . $query['query'] . '</li>';
          }
        }
        if (!count($queries)) {
          $output .= '<li class="none">No queries</li>';
        }
        $output .= '</ul>';
      }
    }
    $output .= '</div>';
    unset($_SESSION['update_results']);
  }
  return $output;
}