function update_do_updates in Drupal 5
Same name and namespace in other branches
- 4 update.php \update_do_updates()
Perform updates for one second or until finished.
Return value
An array indicating the status after doing updates. The first element is the overall percentage finished. The second element is a status message.
2 calls to update_do_updates()
- update_do_update_page in ./
update.php - Perform updates for the JS version and return progress.
- update_progress_page_nojs in ./
update.php - Perform updates for the non-JS version and return the status page.
File
- ./
update.php, line 423 - Administrative page for handling updates from one Drupal version to another.
Code
function update_do_updates() {
while (isset($_SESSION['update_remaining']) && ($update = reset($_SESSION['update_remaining']))) {
$update_finished = update_data($update['module'], $update['version']);
if ($update_finished == 1) {
// Dequeue the completed update.
unset($_SESSION['update_remaining'][key($_SESSION['update_remaining'])]);
$update_finished = 0;
// Make sure this step isn't counted double
}
if (timer_read('page') > 1000) {
break;
}
}
if ($_SESSION['update_total']) {
$percentage = floor(($_SESSION['update_total'] - count($_SESSION['update_remaining']) + $update_finished) / $_SESSION['update_total'] * 100);
}
else {
$percentage = 100;
}
// When no updates remain, clear the caches in case the data has been updated.
if (!isset($update['module'])) {
cache_clear_all('*', 'cache', TRUE);
cache_clear_all('*', 'cache_page', TRUE);
cache_clear_all('*', 'cache_menu', TRUE);
cache_clear_all('*', 'cache_filter', TRUE);
drupal_clear_css_cache();
}
return array(
$percentage,
isset($update['module']) ? 'Updating ' . $update['module'] . ' module' : 'Updating complete',
);
}