Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/herald/garbagecollector/HeraldTranscriptGarbageCollector.php
12256 views
1
<?php
2
3
final class HeraldTranscriptGarbageCollector
4
extends PhabricatorGarbageCollector {
5
6
const COLLECTORCONST = 'herald.transcripts';
7
8
public function getCollectorName() {
9
return pht('Herald Transcripts');
10
}
11
12
public function getDefaultRetentionPolicy() {
13
return phutil_units('30 days in seconds');
14
}
15
16
protected function collectGarbage() {
17
$table = new HeraldTranscript();
18
$conn_w = $table->establishConnection('w');
19
20
queryfx(
21
$conn_w,
22
'UPDATE %T SET
23
objectTranscript = "",
24
ruleTranscripts = "",
25
conditionTranscripts = "",
26
applyTranscripts = "",
27
garbageCollected = 1
28
WHERE garbageCollected = 0 AND time < %d
29
LIMIT 100',
30
$table->getTableName(),
31
$this->getGarbageEpoch());
32
33
return ($conn_w->getAffectedRows() == 100);
34
}
35
36
}
37
38