You are here

scheduler.drush.inc in Scheduler 8

Same filename and directory in other branches
  1. 7 scheduler.drush.inc
  2. 2.x scheduler.drush.inc

Drush commands for Scheduler.

File

scheduler.drush.inc
View source
<?php

/**
 * @file
 * Drush commands for Scheduler.
 */

/**
 * Implements hook_drush_command().
 */
function scheduler_drush_command() {
  $items = [];
  $items['scheduler-cron'] = [
    'description' => 'Lightweight cron to process scheduler tasks.',
    'core' => [
      '8+',
    ],
    'aliases' => [
      'sch-cron',
    ],
    'category' => 'scheduler',
    'options' => [
      'nomsg' => 'to avoid the "cron completed" message being written to the terminal.',
    ],
  ];
  return $items;
}

/**
 * Run lightweight scheduler cron.
 */
function drush_scheduler_cron() {
  \Drupal::service('scheduler.manager')
    ->runLightweightCron();
  $nomsg = drush_get_option('nomsg', NULL);
  $nomsg ? NULL : \Drupal::messenger()
    ->addMessage(t('Scheduler lightweight cron completed'));
}

Functions

Namesort descending Description
drush_scheduler_cron Run lightweight scheduler cron.
scheduler_drush_command Implements hook_drush_command().