Commit 999da3dd authored by Jonathan Smith's avatar Jonathan Smith Committed by Jonathan Smith
Browse files

Issue #3224263 by jonathan1055: Remove scheduler.drush.inc as drush 8 is no...

Issue #3224263 by jonathan1055: Remove scheduler.drush.inc as drush 8 is no longer supported. Drush 9 is available from core 8.4
parent 3bb21ab7
Loading
Loading
Loading
Loading

scheduler.drush.inc

deleted100644 → 0
+0 −51
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Drush 8 commands for Scheduler.
 *
 * For Drush 9+ the commands are in src/Commands/SchedulerCommands.php.
 */

/**
 * 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.',
    ],
  ];

  $items['scheduler-entity-update'] = [
    'description' => 'Entity Update - Add missing Scheduler db fields for entities covered by plugins.',
    'core' => ['8+'],
    'aliases' => ['sch-ent-upd'],
    'category' => 'scheduler',
  ];
  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'));
}

/**
 * Call SchedulerManager entityUpdate() to add missing db fields.
 */
function drush_scheduler_entity_update() {
  $result = \Drupal::service('scheduler.manager')->entityUpdate();
  $updated = $result ? implode(', ', $result) : t('nothing to update');
  \Drupal::messenger()->addMessage(t('Scheduler entity update - @updated', ['@updated' => $updated]));
}