mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-02 01:48:23 +01:00
878a493301
Summary: Ref T9494. Improve support infrastructure for garbage collectors. Test Plan: - Ran `bin/phd debug trigger`, saw collectors execute. {F857852} Reviewers: chad Reviewed By: chad Maniphest Tasks: T9494 Differential Revision: https://secure.phabricator.com/D14218
31 lines
699 B
PHP
31 lines
699 B
PHP
<?php
|
|
|
|
final class MetaMTAMailReceivedGarbageCollector
|
|
extends PhabricatorGarbageCollector {
|
|
|
|
const COLLECTORCONST = 'metamta.received';
|
|
|
|
public function getCollectorName() {
|
|
return pht('Mail (Received)');
|
|
}
|
|
|
|
public function getDefaultRetentionPolicy() {
|
|
return phutil_units('90 days in seconds');
|
|
}
|
|
|
|
public function collectGarbage() {
|
|
$ttl = phutil_units('90 days in seconds');
|
|
|
|
$table = new PhabricatorMetaMTAReceivedMail();
|
|
$conn_w = $table->establishConnection('w');
|
|
|
|
queryfx(
|
|
$conn_w,
|
|
'DELETE FROM %T WHERE dateCreated < %d LIMIT 100',
|
|
$table->getTableName(),
|
|
time() - $ttl);
|
|
|
|
return ($conn_w->getAffectedRows() == 100);
|
|
}
|
|
|
|
}
|