[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/herald/garbagecollector/ -> HeraldTranscriptGarbageCollector.php (source)

   1  <?php
   2  
   3  final class HeraldTranscriptGarbageCollector
   4    extends PhabricatorGarbageCollector {
   5  
   6    public function collectGarbage() {
   7      $ttl = PhabricatorEnv::getEnvConfig('gcdaemon.ttl.herald-transcripts');
   8      if ($ttl <= 0) {
   9        return false;
  10      }
  11  
  12      $table = new HeraldTranscript();
  13      $conn_w = $table->establishConnection('w');
  14  
  15      queryfx(
  16        $conn_w,
  17        'UPDATE %T SET
  18            objectTranscript     = "",
  19            ruleTranscripts      = "",
  20            conditionTranscripts = "",
  21            applyTranscripts     = "",
  22            garbageCollected     = 1
  23          WHERE garbageCollected = 0 AND `time` < %d
  24          LIMIT 100',
  25        $table->getTableName(),
  26        time() - $ttl);
  27  
  28      return ($conn_w->getAffectedRows() == 100);
  29    }
  30  
  31  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1