You are here

function simplenews_clear_spool in Simplenews 7.2

Same name and namespace in other branches
  1. 6.2 includes/simplenews.mail.inc \simplenews_clear_spool()
  2. 6 simplenews.module \simplenews_clear_spool()
  3. 7 includes/simplenews.mail.inc \simplenews_clear_spool()

Remove old records from mail spool table.

All records with status 'send' and time stamp before the expiration date are removed from the spool.

Return value

Number of deleted spool rows.

Related topics

4 calls to simplenews_clear_spool()
drush_simplenews_spool_send in ./simplenews.drush.inc
Drush command to send the mail spool queue.
SimplenewsSendTestCase::testProgrammaticNewsletter in tests/simplenews.test
Creates and sends a node using the API.
simplenews_cron in ./simplenews.module
Implements hook_cron().
simplenews_mail_attempt_immediate_send in includes/simplenews.mail.inc
Send mail spool immediatly if cron should not be used.
1 string reference to 'simplenews_clear_spool'
simplenews_mail_attempt_immediate_send in includes/simplenews.mail.inc
Send mail spool immediatly if cron should not be used.

File

includes/simplenews.mail.inc, line 561
Simplenews email send and spool handling

Code

function simplenews_clear_spool() {
  $expiration_time = REQUEST_TIME - variable_get('simplenews_spool_expire', 0) * 86400;
  return db_delete('simplenews_mail_spool')
    ->condition('status', SIMPLENEWS_SPOOL_DONE)
    ->condition('timestamp', $expiration_time, '<=')
    ->execute();
}