mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-04 20:52:43 +01:00
9f35c7cc26
Summary: This modularizes the rest of the GC submethods. Turned out there was nothing tricky. Test Plan: Ran `bin/phd debug garbage` and got reasonable looking behavior and output. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7971
25 lines
592 B
PHP
25 lines
592 B
PHP
<?php
|
|
|
|
final class ConduitConnectionGarbageCollector
|
|
extends PhabricatorGarbageCollector {
|
|
|
|
public function collectGarbage() {
|
|
$key = 'gcdaemon.ttl.conduit-logs';
|
|
$ttl = PhabricatorEnv::getEnvConfig($key);
|
|
if ($ttl <= 0) {
|
|
return false;
|
|
}
|
|
|
|
$table = new PhabricatorConduitConnectionLog();
|
|
$conn_w = $table->establishConnection('w');
|
|
queryfx(
|
|
$conn_w,
|
|
'DELETE FROM %T WHERE dateCreated < %d
|
|
ORDER BY dateCreated ASC LIMIT 100',
|
|
$table->getTableName(),
|
|
time() - $ttl);
|
|
|
|
return ($conn_w->getAffectedRows() == 100);
|
|
}
|
|
|
|
}
|