update_finished_page

  1. drupal
    1. 4.7
    2. 5
Versions
4.7 – 5 update_finished_page($success)

Code

./update.php, line 487

<?php
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">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">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 ($_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;
}
?>