You are here

public function BaseUpdateRunner::addUpdatesToQueue in Scheduled Updates 8

Add all updates to queue.

Overrides UpdateRunnerInterface::addUpdatesToQueue

File

src/Plugin/BaseUpdateRunner.php, line 132
Contains \Drupal\scheduled_updates\Plugin\BaseUpdateRunner.

Class

BaseUpdateRunner

Namespace

Drupal\scheduled_updates\Plugin

Code

public function addUpdatesToQueue() {
  $updates = $this
    ->getAllUpdates();
  if ($updates) {
    $queue = $this
      ->getQueue();
    foreach ($updates as $update) {
      $queue
        ->createItem($update);

      /** @var ScheduledUpdate $update */
      $update = ScheduledUpdate::load($update['update_id']);
      $update->status = ScheduledUpdateInterface::STATUS_INQUEUE;
      $update
        ->save();
    }
  }
}