update_do_updates
./update.php, строка 423
- Версии
- 5
update_do_updates()
Perform updates for one second or until finished.
Возвращаемое значение
An array indicating the status after doing updates. The first element is the overall percentage finished. The second element is a status message.
Код
<?php
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');
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии