You are here

public function UpdateRunnerUtils::runAllUpdates in Scheduled Updates 8

Run run updates for all types.

Parameters

array $update_types: Ids of updates to run.

bool $run_by_cron: Whether or not the updates are run by cron.

File

src/UpdateRunnerUtils.php, line 129
Contains \Drupal\scheduled_updates\UpdateRunnerUtils.

Class

UpdateRunnerUtils
A service that runs all available updaters

Namespace

Drupal\scheduled_updates

Code

public function runAllUpdates(array $update_types = [], $run_by_cron = FALSE) {
  $time_end = time() + $this
    ->getTimeout();
  $runners = $this
    ->getUpdateTypeRunners($update_types);
  foreach ($runners as $runner) {
    $runner
      ->setRunByCron($run_by_cron);
    $runner
      ->addUpdatesToQueue();
    $runner
      ->runUpdatesInQueue($time_end);
    if ($time_end < time()) {
      break;
    }
  }
}