You are here

function simplenews_cron in Simplenews 8

Same name and namespace in other branches
  1. 8.2 simplenews.module \simplenews_cron()
  2. 5 simplenews.module \simplenews_cron()
  3. 6.2 simplenews.module \simplenews_cron()
  4. 6 simplenews.module \simplenews_cron()
  5. 7.2 simplenews.module \simplenews_cron()
  6. 7 simplenews.module \simplenews_cron()
  7. 3.x simplenews.module \simplenews_cron()

Implements hook_cron().

3 calls to simplenews_cron()
SimplenewsSendTest::testDelete in src/Tests/SimplenewsSendTest.php
Create a newsletter, send mails and then delete.
SimplenewsSendTest::testSendNowCron in src/Tests/SimplenewsSendTest.php
Send a newsletter without using cron.
SimplenewsSendTest::testSendNowCronThrottle in src/Tests/SimplenewsSendTest.php
Send a newsletter using cron and a low throttle.
1 string reference to 'simplenews_cron'
ultimate_cron.job.simplenews_cron.yml in config/optional/ultimate_cron.job.simplenews_cron.yml
config/optional/ultimate_cron.job.simplenews_cron.yml

File

./simplenews.module, line 324
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_cron() {
  if (!simplenews_assert_uri()) {
    return;
  }
  $config = \Drupal::config('simplenews.settings');
  \Drupal::service('simplenews.mailer')
    ->sendSpool($config
    ->get('mail.throttle'));
  \Drupal::service('simplenews.spool_storage')
    ->clear();

  // Update sent status for newsletter admin panel.
  \Drupal::service('simplenews.mailer')
    ->updateSendStatus();
}