3 final class MetaMTAMailSentGarbageCollector
4 extends PhabricatorGarbageCollector
{
6 const COLLECTORCONST
= 'metamta.sent';
8 public function getCollectorName() {
9 return pht('Mail (Sent)');
12 public function getDefaultRetentionPolicy() {
13 return phutil_units('90 days in seconds');
16 protected function collectGarbage() {
17 $mails = id(new PhabricatorMetaMTAMail())->loadAllWhere(
18 'dateCreated < %d LIMIT 100',
19 $this->getGarbageEpoch());
21 $engine = new PhabricatorDestructionEngine();
22 foreach ($mails as $mail) {
23 $engine->destroyObject($mail);
26 return (count($mails) == 100);