You are here

function simplenews_clear_spool in Simplenews 6.2

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

Remove records from mail spool table.

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

Return value

Count deleted

2 calls to simplenews_clear_spool()
simplenews_cron in ./simplenews.module
Implementation of hook_cron().
simplenews_send_node in includes/simplenews.mail.inc
Send newsletter node to subscribers.

File

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

Code

function simplenews_clear_spool() {
  $expiration_time = time() - variable_get('simplenews_spool_expire', 0) * 86400;
  db_query("\n    DELETE FROM {simplenews_mail_spool}\n    WHERE status = %d\n      AND timestamp <= %d", SIMPLENEWS_SPOOL_DONE, $expiration_time);
  $deleted_count = db_affected_rows();
  return $deleted_count;
}