You are here

protected function CronJobDiscovery::ensureCronJobExists in Ultimate Cron 8.2

Creates a new cron job with specific values.

Parameters

array $info: Module info.

string $id: Module name.

1 call to CronJobDiscovery::ensureCronJobExists()
CronJobDiscovery::discoverCronJobs in src/CronJobDiscovery.php
Automatically discovers and creates default cron jobs.

File

src/CronJobDiscovery.php, line 105

Class

CronJobDiscovery
Discovery and instantiation of default cron jobs.

Namespace

Drupal\ultimate_cron

Code

protected function ensureCronJobExists($info, $id) {
  $job = NULL;
  if (!CronJob::load($id)) {
    $values = array(
      'title' => $this
        ->getJobTitle($id),
      'id' => $id,
      'module' => $info['module'],
      'callback' => $info['callback'],
    );
    $job = CronJob::create($values);
    $job
      ->save();
  }
}