You are here

public function UpdateRunnerUtils::getUpdateTypeRunners in Scheduled Updates 8

Get update runner for scheduled update types.

Parameters

array $update_types: Update ids to load runners for. If empty return all.

Return value

\Drupal\scheduled_updates\Plugin\UpdateRunnerInterface[]

2 calls to UpdateRunnerUtils::getUpdateTypeRunners()
UpdateRunnerUtils::invokeEntityUpdate in src/UpdateRunnerUtils.php
UpdateRunnerUtils::runAllUpdates in src/UpdateRunnerUtils.php
Run run updates for all types.

File

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

Class

UpdateRunnerUtils
A service that runs all available updaters

Namespace

Drupal\scheduled_updates

Code

public function getUpdateTypeRunners(array $update_types = []) {
  $bundles = $this->entityTypeBundleInfo
    ->getBundleInfo('scheduled_update');

  /** @var UpdateRunnerInterface[] $runners */
  $runners = [];
  foreach ($bundles as $bundle => $bundle_info) {
    if (empty($update_types) || in_array($bundle, $update_types)) {

      /** @var ScheduledUpdateType $updater */
      $updater = ScheduledUpdateType::load($bundle);
      if ($runner = $this
        ->getUpdateRunnerInstance($updater)) {
        $runners[$bundle] = $runner;
      }
      else {

        // @todo User logger for missing plugins

        /* drupal_set_message(t('Missing plugin in @plugin_id in update type @type',
           [
             '@plugin_id' => $runner_settings['id'],
             '@type' => $updater->label(),
           ])); */
      }
    }
  }
  return $runners;
}