protected function loadPage()
 {
     $table = new HarbormasterBuildLog();
     $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);
 }
 private function computeDetails(HarbormasterBuildLog $log)
 {
     $bytes = 0;
     $chunks = 0;
     $hash = hash_init('sha1');
     foreach ($log->newChunkIterator() as $chunk) {
         $bytes += strlen($chunk->getChunk());
         $chunks++;
         hash_update($hash, $chunk->getChunkDisplayText());
     }
     return array('bytes' => $bytes, 'chunks' => $chunks, 'hash' => hash_final($hash));
 }
 public function createLog(HarbormasterBuildTarget $build_target, $log_source, $log_type)
 {
     $log_source = id(new PhutilUTF8StringTruncator())->setMaximumBytes(250)->truncateString($log_source);
     $log = HarbormasterBuildLog::initializeNewBuildLog($build_target)->setLogSource($log_source)->setLogType($log_type)->save();
     return $log;
 }
 public function newLog($log_source, $log_type)
 {
     $log_source = id(new PhutilUTF8StringTruncator())->setMaximumBytes(250)->truncateString($log_source);
     $log = HarbormasterBuildLog::initializeNewBuildLog($this)->setLogSource($log_source)->setLogType($log_type);
     $log->start();
     return $log;
 }