public function SpoolStorage::clear in Simplenews 8
Same name and namespace in other branches
- 8.2 src/Spool/SpoolStorage.php \Drupal\simplenews\Spool\SpoolStorage::clear()
- 3.x src/Spool/SpoolStorage.php \Drupal\simplenews\Spool\SpoolStorage::clear()
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
int Number of deleted spool rows.
Overrides SpoolStorageInterface::clear
File
- src/
Spool/ SpoolStorage.php, line 203
Class
- SpoolStorage
- Default database spool storage.
Namespace
Drupal\simplenews\SpoolCode
public function clear() {
$expiration_time = REQUEST_TIME - $this->config
->get('mail.spool_expire') * 86400;
return $this->connection
->delete('simplenews_mail_spool')
->condition('status', [
SpoolStorageInterface::STATUS_DONE,
SpoolStorageInterface::STATUS_SKIPPED,
], 'IN')
->condition('timestamp', $expiration_time, '<=')
->execute();
}