You are here

function drush_simplenews_spool_count in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 simplenews.drush.inc \drush_simplenews_spool_count()
  2. 8 simplenews.drush.inc \drush_simplenews_spool_count()
  3. 7.2 simplenews.drush.inc \drush_simplenews_spool_count()
  4. 7 simplenews.drush.inc \drush_simplenews_spool_count()

Drush command to count the mail spool queue.

File

./simplenews.drush.inc, line 46
Drush commands for administer Simplenews.

Code

function drush_simplenews_spool_count() {
  $count = \Drupal::service('simplenews.spool_storage')
    ->countMails();
  $no_description = drush_get_option([
    'p',
    'pipe',
  ]);
  if ($no_description) {
    drush_print_pipe($count);
  }
  else {
    \Drupal::logger('simplenews')
      ->status('Current simplenews mail spool count: @count', [
      '@count' => $count,
    ]);
  }
}