public function get_history_by_hourly() { $stime = strtotime(date('Y-m-d H:00:00')) - 86400 + 3600; $s = intval(date('H', $stime)); $etime = $stime + 3600; $hist = array(); for ($i = 0; $i < 24; $i++) { $hist[$s] = (int) C(BibitterCounter)->find_sum('times', Q::gte('updated', $stime), Q::lt('updated', $etime)); $stime += 3600; $etime += 3600; $s = $s + 1 >= 24 ? 0 : $s + 1; } return $hist; }
public function generate_release_notes() { if ($this->is_latest_release_id()) { $latest_release = $this->latest_release(); $changesets = C(OpenpearChangeset)->find_all(Q::eq('package_id', $this->id), Q::gte('created', $latest_release->created())); } else { $changesets = C(OpenpearChangeset)->find_all(Q::eq('package_id', $this->id)); } $notes = ''; foreach ($changesets as $changeset) { $notes .= '- '; $notes .= $changeset->comment(); $notes .= "\n"; } return $notes; }