protected function collectGarbage() { $table = new PhabricatorDaemonLogEvent(); $conn_w = $table->establishConnection('w'); queryfx($conn_w, 'DELETE FROM %T WHERE epoch < %d LIMIT 100', $table->getTableName(), $this->getGarbageEpoch()); return $conn_w->getAffectedRows() == 100; }
public function collectGarbage() { $ttl = PhabricatorEnv::getEnvConfig('gcdaemon.ttl.daemon-logs'); if ($ttl <= 0) { return false; } $table = new PhabricatorDaemonLogEvent(); $conn_w = $table->establishConnection('w'); queryfx($conn_w, 'DELETE FROM %T WHERE epoch < %d LIMIT 100', $table->getTableName(), time() - $ttl); return $conn_w->getAffectedRows() == 100; }
protected function execute(ConduitAPIRequest $request) { $daemon_event = new PhabricatorDaemonLogEvent(); $daemon_event->setLogID($request->getValue('daemonLogID')); $daemon_event->setLogType($request->getValue('type')); $daemon_event->setMessage((string) $request->getValue('message')); $daemon_event->setEpoch(time()); $daemon_event->save(); return; }