diff --git a/simplenews.drush.inc b/simplenews.drush.inc index 57a336c..8683b3f 100644 --- a/simplenews.drush.inc +++ b/simplenews.drush.inc @@ -1,40 +1,41 @@ 'Print the current simplenews mail spool count', - 'aliases' => array('sn-sc'), - 'drupal dependencies' => array('simplenews'), - 'options' => array( + 'aliases' => ['sn-sc'], + 'drupal dependencies' => ['simplenews'], + 'options' => [ 'pipe' => dt('Just print the count value to allow parsing'), - ) - ); + ], + ]; - $items['simplenews-spool-send'] = array( + $items['simplenews-spool-send'] = [ 'description' => 'Send the defined amount of mail spool entries.', - 'examples' => array( - 'drush sn-ss' => dt('Send the default amount of mails, as defined by the simplenews_throttle variable.'), + 'examples' => [ + 'drush sn-ss' => dt('Send the default amount of mails, as defined by the mail.throttle settings.'), 'drush sn-ss 0' => dt('Send all mails.'), - 'drush sn-ss 100' => dt('Send 100 mails'), - ), - 'options' => array( + 'drush sn-ss 100' => dt('Send 100 mails.'), + ], + 'options' => [ + 'limit' => dt('Number of mails to send. 0 sends all emails. If not specified, will be set to the value of the mail.throttle in the module settings config.'), 'pipe' => dt('Just print the sent and remaining count on separate lines to allow parsing'), - ), - 'aliases' => array('sn-ss'), - 'drupal dependencies' => array('simplenews'), - ); + ], + 'aliases' => ['sn-ss'], + 'drupal dependencies' => ['simplenews'], + ]; return $items; } @@ -46,12 +47,12 @@ function drush_simplenews_spool_count() { $count = \Drupal::service('simplenews.spool_storage')->countMails(); - $no_description = drush_get_option(array('p', 'pipe')); + $no_description = drush_get_option(['p', 'pipe']); if ($no_description) { drush_print_pipe($count); } else { - drush_log(dt('Current simplenews mail spool count: @count', array('@count' => $count)), 'status'); + drush_log(dt('Current simplenews mail spool count: @count', ['@count' => $count]), 'status'); } } @@ -82,13 +83,14 @@ function drush_simplenews_spool_send($limit = FALSE) { // Report the number of sent mails. if ($sent > 0) { $remaining = \Drupal::service('simplenews.spool_storage')->countMails(); - if (drush_get_option(array('p', 'pipe'))) { - // For pipe, print the sent first and then the remaining count, separated by a space. + if (drush_get_option(['p', 'pipe'])) { + // For pipe, print the sent first and then the remaining count, separated + // by a space. drush_print_pipe($sent . " " . $remaining); } else { - drush_log(dt('Sent @count mails from the queue in @sec seconds.', array('@count' => $sent, '@sec' => $durance)), 'status'); - drush_log(dt('Remaining simplenews mail spool count: @count', array('@count' => $remaining)), 'status'); + drush_log(dt('Sent @count mails from the queue in @sec seconds.', ['@count' => $sent, '@sec' => $durance]), 'status'); + drush_log(dt('Remaining simplenews mail spool count: @count', ['@count' => $remaining]), 'status'); } }