本文整理汇总了PHP中BoincUser::sum方法的典型用法代码示例。如果您正苦于以下问题:PHP BoincUser::sum方法的具体用法?PHP BoincUser::sum怎么用?PHP BoincUser::sum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoincUser
的用法示例。
在下文中一共展示了BoincUser::sum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: project_flops
function project_flops()
{
$x = BoincUser::sum("expavg_credit");
if ($x == 0) {
$x = 200;
}
$y = 1000000000.0 * $x / 200;
return $y;
}
示例2: get_job_status
function get_job_status()
{
$s = unserialize(get_cached_data(STATUS_PAGE_TTL, "job_status"));
if ($s) {
return $s;
}
$s = new StdClass();
$apps = BoincApp::enum("deprecated=0");
foreach ($apps as $app) {
$info = BoincDB::get()->lookup_fields("result", "stdClass", "ceil(avg(elapsed_time)/3600*100)/100 as avg,\n ceil(min(elapsed_time)/3600*100)/100 as min,\n ceil(max(elapsed_time)/3600*100)/100 as max,\n count(distinct userid) as users", "appid = {$app->id}\n AND validate_state=1\n AND received_time > (unix_timestamp()-86400)\n ");
$app->info = $info;
$app->unsent = BoincResult::count("appid={$app->id} and server_state=2");
$app->in_progress = BoincResult::count("appid={$app->id} and server_state=4");
}
$s->apps = $apps;
$s->results_ready_to_send = BoincResult::count("server_state=2");
$s->results_in_progress = BoincResult::count("server_state=4");
$s->results_need_file_delete = BoincResult::count("file_delete_state=1");
$s->wus_need_validate = BoincWorkunit::count("need_validate=1");
$s->wus_need_assimilate = BoincWorkunit::count("assimilate_state=1");
$s->wus_need_file_delete = BoincWorkunit::count("file_delete_state=1");
$x = BoincDB::get()->lookup_fields("workunit", "stdClass", "MIN(transition_time) as min", "TRUE");
$gap = (time() - $x->min) / 3600;
if ($gap < 0 || $x->min == 0) {
$gap = 0;
}
$s->transitioner_backlog = $gap;
$s->users_with_recent_credit = BoincUser::count("expavg_credit>1");
$s->users_with_credit = BoincUser::count("total_credit>1");
$s->users_past_24_hours = BoincUser::count("create_time > (unix_timestamp() - 86400)");
$s->hosts_with_recent_credit = BoincHost::count("expavg_credit>1");
$s->hosts_with_credit = BoincHost::count("total_credit>1");
$s->hosts_past_24_hours = BoincHost::count("create_time > (unix_timestamp() - 86400)");
$s->flops = BoincUser::sum("expavg_credit") / 200;
$s->db_revision = null;
if (file_exists("../../db_revision")) {
$s->db_revision = trim(file_get_contents("../../db_revision"));
}
$s->cached_time = time();
$e = set_cached_data(STATUS_PAGE_TTL, serialize($s), "job_status");
if ($e) {
echo "set_cached_data(): {$e}\n";
}
return $s;
}