You are here

function simplenews_cron in Simplenews 3.x

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

Implements hook_cron().

6 calls to simplenews_cron()
SimplenewsRecipientHandlerTest::checkRecipients in tests/src/Functional/SimplenewsRecipientHandlerTest.php
Checks the expected users received mails.
SimplenewsRecipientHandlerTest::setUp in tests/src/Functional/SimplenewsRecipientHandlerTest.php
SimplenewsSendTest::testDelete in tests/src/Functional/SimplenewsSendTest.php
Create a newsletter, send mails and then delete.
SimplenewsSendTest::testSendFail in tests/src/Functional/SimplenewsSendTest.php
Tests failing to send mails from cron.
SimplenewsSendTest::testSendNowCron in tests/src/Functional/SimplenewsSendTest.php
Send a newsletter using cron.

... See full list

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 329
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();

  // Tidy subscriptions.
  \Drupal::service('simplenews.subscription_manager')
    ->tidy();
}