protected function collectGarbage() { $table = new PhabricatorDaemonLog(); $conn_w = $table->establishConnection('w'); queryfx($conn_w, 'DELETE FROM %T WHERE dateCreated < %d AND status != %s LIMIT 100', $table->getTableName(), $this->getGarbageEpoch(), PhabricatorDaemonLog::STATUS_RUNNING); return $conn_w->getAffectedRows() == 100; }
protected function loadPage() { $table = new PhabricatorDaemonLog(); $conn_r = $table->establishConnection('r'); $data = queryfx_all($conn_r, 'SELECT * FROM %T %Q %Q %Q', $table->getTableName(), $this->buildWhereClause($conn_r), $this->buildOrderClause($conn_r), $this->buildLimitClause($conn_r)); return $table->loadAllFromArray($data); }
public function collectGarbage() { $ttl = PhabricatorEnv::getEnvConfig('gcdaemon.ttl.daemon-logs'); if ($ttl <= 0) { return false; } $table = new PhabricatorDaemonLog(); $conn_w = $table->establishConnection('w'); queryfx($conn_w, 'DELETE FROM %T WHERE dateCreated < %d AND status != %s LIMIT 100', $table->getTableName(), time() - $ttl, PhabricatorDaemonLog::STATUS_RUNNING); return $conn_w->getAffectedRows() == 100; }