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 static function fetch_queues($type, $limit = 5) { return C(OpenpearQueue)->find_all(new Paginator($limit), Q::lt('locked', time()), Q::eq('type', $type), Q::order('updated')); }
<?php require_once dirname(__DIR__) . '/__settings__.php'; try { $queue = C(OpenpearNewprojectQueue)->find_get(Q::lt('trial_count', 5), Q::order('id')); $queue->create(); } catch (Exception $e) { # pass }