update_page
- Versions
- 4.6
update_page()
Code
./update.php, line 59
<?php
function update_page() {
global $user, $sql_updates;
if (isset($_POST['edit'])) {
$edit = $_POST['edit'];
}
if (isset($_POST['op'])) {
$op = $_POST['op'];
}
switch ($op) {
case "Update":
// make sure we have updates to run.
print update_page_header("Drupal database update");
$links[] = "<a href=\"index.php\">main page</a>";
$links[] = "<a href=\"index.php?q=admin\">administration pages</a>";
print theme("item_list", $links);
// NOTE: we can't use l() here because the URL would point to 'update.php?q=admin'.
if ($edit["start"] == -1) {
print "No updates to perform.";
}
else {
update_data($edit["start"]);
}
print "<br />Updates were attempted. If you see no failures above, you may proceed happily to the <a href=\"index.php?q=admin\">administration pages</a>.";
print " Otherwise, you may need to update your database manually.";
print update_page_footer();
break;
default:
// NOTE: We need the following five lines in order to fix a bug with
// database.mysql (issue #15337). We should be able to remove
// this work around in the future.
$result = db_query("SELECT * FROM {variable} WHERE name = 'update_start' AND value LIKE '%;\"'");
if ($variable = db_fetch_object($result)) {
$variable->value = unserialize(substr($variable->value, 0, -2) .'";');
variable_set('update_start', $variable->value);
}
$start = variable_get("update_start", 0);
$dates[] = "All";
$i = 1;
foreach ($sql_updates as $date => $sql) {
$dates[$i++] = $date;
if ($date == $start) {
$selected = $i;
}
}
$dates[$i] = "No updates available";
// make update form and output it.
$form = form_select("Perform updates from", "start", (isset($selected) ? $selected : -1), $dates, "This defaults to the first available update since the last update you performed.");
$form .= form_submit("Update");
print update_page_header("Drupal database update");
print form($form);
print update_page_footer();
break;
}
}
?>Login or register to post comments 