[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/daemon/garbagecollector/ -> PhabricatorDaemonLogGarbageCollector.php (source)

   1  <?php
   2  
   3  final class PhabricatorDaemonLogGarbageCollector
   4    extends PhabricatorGarbageCollector {
   5  
   6    public function collectGarbage() {
   7      $ttl = PhabricatorEnv::getEnvConfig('gcdaemon.ttl.daemon-logs');
   8      if ($ttl <= 0) {
   9        return false;
  10      }
  11  
  12      $table = new PhabricatorDaemonLog();
  13      $conn_w = $table->establishConnection('w');
  14  
  15      queryfx(
  16        $conn_w,
  17        'DELETE FROM %T WHERE dateCreated < %d AND status != %s LIMIT 100',
  18        $table->getTableName(),
  19        time() - $ttl,
  20        PhabricatorDaemonLog::STATUS_RUNNING);
  21  
  22      return ($conn_w->getAffectedRows() == 100);
  23    }
  24  
  25  }


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