Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / files / garbagecollector / PhabricatorFileExternalRequestGarbageCollector.php
blobc7e618fb70b0e154b37dd1a1d44437402864e285
1 <?php
3 final class PhabricatorFileExternalRequestGarbageCollector
4 extends PhabricatorGarbageCollector {
6 const COLLECTORCONST = 'files.externalttl';
8 public function getCollectorName() {
9 return pht('External Requests (TTL)');
12 public function hasAutomaticPolicy() {
13 return true;
16 protected function collectGarbage() {
17 $file_requests = id(new PhabricatorFileExternalRequest())->loadAllWhere(
18 'ttl < %d LIMIT 100',
19 PhabricatorTime::getNow());
20 $engine = new PhabricatorDestructionEngine();
21 foreach ($file_requests as $request) {
22 $engine->destroyObject($request);
25 return (count($file_requests) == 100);