@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorFileTemporaryGarbageCollector
4 extends PhabricatorGarbageCollector {
5
6 const COLLECTORCONST = 'files.ttl';
7
8 public function getCollectorName() {
9 return pht('Files (TTL)');
10 }
11
12 public function hasAutomaticPolicy() {
13 return true;
14 }
15
16 protected function collectGarbage() {
17 $files = id(new PhabricatorFile())->loadAllWhere(
18 'ttl < %d LIMIT 100',
19 PhabricatorTime::getNow());
20
21 $engine = new PhabricatorDestructionEngine();
22
23 foreach ($files as $file) {
24 $engine->destroyObject($file);
25 }
26
27 return (count($files) == 100);
28 }
29
30}