当前位置: 首页>>代码示例>>PHP>>正文


PHP BoincUser::count方法代码示例

本文整理汇总了PHP中BoincUser::count方法的典型用法代码示例。如果您正苦于以下问题:PHP BoincUser::count方法的具体用法?PHP BoincUser::count怎么用?PHP BoincUser::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BoincUser的用法示例。


在下文中一共展示了BoincUser::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_cached_data

}
if ($user->id == $team->ping_user) {
    $get_from_db = true;
}
// Cache the team record, its forum record, its new members,
// its admins, and its member counts
$cache_args = "teamid={$teamid}";
if (!$get_from_db) {
    $cached_data = get_cached_data(TEAM_PAGE_TTL, $cache_args);
    if ($cached_data) {
        // We found some old but non-stale data, let's use it
        $team = unserialize($cached_data);
    } else {
        $get_from_db = true;
    }
}
if ($get_from_db) {
    $team->nusers = BoincUser::count("teamid={$teamid}");
    $team->nusers_worked = BoincUser::count("teamid={$teamid} and total_credit>0");
    $team->nusers_active = BoincUser::count("teamid={$teamid} and expavg_credit>0.1");
    $team->forum = BoincForum::lookup("parent_type=1 and category={$team->id}");
    $team->new_members = new_member_list($teamid);
    $team->admins = admin_list($teamid);
    $team->founder = BoincUser::lookup_id($team->userid);
    set_cached_data(TEAM_PAGE_TTL, serialize($team), $cache_args);
}
if (!$team) {
    error_page(tra("no such team"));
}
display_team_page($team, $user);
page_tail(true);
开发者ID:nicolas17,项目名称:boincgit-test,代码行数:31,代码来源:team_display.php

示例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;
}
开发者ID:suno,项目名称:boinc,代码行数:45,代码来源:server_status.php


注:本文中的BoincUser::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。