Differential D18985 Diff 45536 src/applications/metamta/garbagecollector/MetaMTAMailSentGarbageCollector.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/garbagecollector/MetaMTAMailSentGarbageCollector.php
Show All 12 Lines | public function getDefaultRetentionPolicy() { | ||||
return phutil_units('90 days in seconds'); | return phutil_units('90 days in seconds'); | ||||
} | } | ||||
protected function collectGarbage() { | protected function collectGarbage() { | ||||
$mails = id(new PhabricatorMetaMTAMail())->loadAllWhere( | $mails = id(new PhabricatorMetaMTAMail())->loadAllWhere( | ||||
'dateCreated < %d LIMIT 100', | 'dateCreated < %d LIMIT 100', | ||||
$this->getGarbageEpoch()); | $this->getGarbageEpoch()); | ||||
$engine = new PhabricatorDestructionEngine(); | |||||
foreach ($mails as $mail) { | foreach ($mails as $mail) { | ||||
$mail->delete(); | $engine->destroyObject($mail); | ||||
} | } | ||||
return (count($mails) == 100); | return (count($mails) == 100); | ||||
} | } | ||||
} | } |