1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-26 05:29:06 +01:00
phorge-phorge/src/applications/herald/garbagecollector/HeraldTranscriptGarbageCollector.php

37 lines
869 B
PHP
Raw Normal View History

<?php
final class HeraldTranscriptGarbageCollector
extends PhabricatorGarbageCollector {
const COLLECTORCONST = 'herald.transcripts';
public function getCollectorName() {
return pht('Herald Transcripts');
}
public function getDefaultRetentionPolicy() {
return phutil_units('30 days in seconds');
}
protected function collectGarbage() {
$table = new HeraldTranscript();
$conn_w = $table->establishConnection('w');
queryfx(
$conn_w,
'UPDATE %T SET
objectTranscript = "",
ruleTranscripts = "",
conditionTranscripts = "",
applyTranscripts = "",
garbageCollected = 1
WHERE garbageCollected = 0 AND time < %d
LIMIT 100',
$table->getTableName(),
$this->getGarbageEpoch());
return ($conn_w->getAffectedRows() == 100);
}
}