You are here

public function WebformScheduledEmailCommands::drush_webform_scheduled_email_cron in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_scheduled_email/src/Commands/WebformScheduledEmailCommands.php \Drupal\webform_scheduled_email\Commands\WebformScheduledEmailCommands::drush_webform_scheduled_email_cron()

Executes cron task for webform scheduled emails.

@command webform:scheduled-email:cron

@option schedule_limit The maximum number of emails to be scheduled. If set to 0 no emails will be scheduled. (Default 1000) @option send_limit The maximum number of emails to be sent. If set to 0 no emails will be sent. (Default 500) @aliases wfsec,webform-scheduled-email-cron

Parameters

$webform_id (optional): The webform ID you want the cron task to be executed for

$handler_id (optional): The handler ID you want the cron task to be executed for

See also

webform_scheduled_email_cron_process()

File

modules/webform_scheduled_email/src/Commands/WebformScheduledEmailCommands.php, line 81

Class

WebformScheduledEmailCommands
Webform scheduled email commands for Drush 9.x.

Namespace

Drupal\webform_scheduled_email\Commands

Code

public function drush_webform_scheduled_email_cron($webform_id = NULL, $handler_id = NULL, array $options = [
  'schedule_limit' => 1000,
  'send_limit' => 500,
]) {
  $webform = $webform_id ? Webform::load($webform_id) : NULL;
  $stats = $this->manager
    ->cron($webform, $handler_id, $options['schedule_limit'], $options['send_limit']);
  $this
    ->output()
    ->writeln(dt($stats['_message'], $stats['_context']));
}