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.

▾ 2 функции вызывают 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.

Код

<?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');
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему