function show_platforms()
{
    $xmlFragment = unserialize(get_cached_data(3600, "project_config_platform_xml"));
    if ($xmlFragment == false) {
        $platforms = BoincDB::get()->enum_fields("platform, DBNAME.app_version, DBNAME.app", "BoincPlatform", "platform.name, platform.user_friendly_name, plan_class", "app_version.platformid = platform.id and app_version.appid = app.id and app_version.deprecated=0 and app.deprecated=0 group by platform.name, plan_class", "");
        $xmlFragment = "    <platforms>";
        foreach ($platforms as $platform) {
            $xmlFragment .= "\n            <platform>\n                <platform_name>{$platform->name}</platform_name>\n                <user_friendly_name>{$platform->user_friendly_name}</user_friendly_name>";
            if ($platform->plan_class) {
                $xmlFragment .= "\n                <plan_class>{$platform->plan_class}</plan_class>\n";
            }
            $xmlFragment .= "\n            </platform>";
        }
        $xmlFragment .= "\n    </platforms>\n";
        set_cached_data(3600, serialize($xmlFragment), "project_config_platform_xml");
    }
    echo $xmlFragment;
}
}
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);
        echo "{$x->model}: {$g} gflops {$x->mean_ncores} cores {$x->nhosts} hosts \n";
    }
}
function show_cpu_list($data)
{
    page_head("CPU performance");
    echo "\n        This table shows peak CPU speed\n        (based on Whetstone benchmarks)\n        of computers participating in this project.\n        <p>\n    ";
    start_table();
    row_heading_array(array("CPU model", "Number of computers", "Avg. cores/computer", "GFLOPS/core", "GFLOPs/computer"));
    $i = 0;
    $total_nhosts = 0;
    $total_gflops = 0;
    foreach ($data->cpus as $d) {
        row_array(array($d->model, $d->nhosts, number_format($d->mean_ncores, 2), number_format($d->p_fpops / 1000000000.0, 2), number_format($d->mean_ncores * $d->p_fpops / 1000000000.0, 2)), "row{$i}");
        $total_nhosts += $d->nhosts;
        $total_gflops += $d->nhosts * $d->mean_ncores * $d->p_fpops / 1000000000.0;
        $i = 1 - $i;
    }
    row_array(array("Total", number_format($total_nhosts, 0) . " computers", "", "", number_format($total_gflops / 1000.0, 2) . " TeraFLOPS"), "row{$i}");
    end_table();
    echo "Generated " . time_str($data->time);
    page_tail();
}
$d = get_cached_data(86400);
if ($d) {
    $data = unserialize($d);
} else {
    $data = get_cpu_list();
    set_cached_data(86400, serialize($data));
}
show_cpu_list($data);
 $cache_args = "userid=" . $id;
 $cached_data = get_cached_data(USER_PAGE_TTL, $cache_args);
 if ($cached_data) {
     // We found some old but non-stale data, let's use it
     $data = unserialize($cached_data);
     $user = $data->user;
     $community_links = $data->clo;
 } else {
     // No data was found, generate new data for the cache and store it
     $user = lookup_user_id($id);
     BoincForumPrefs::lookup($user);
     $user = @get_other_projects($user);
     $community_links = get_community_links_object($user);
     $data->user = $user;
     $data->clo = $community_links;
     set_cached_data(USER_PAGE_TTL, serialize($data), $cache_args);
 }
 if (!$user->id) {
     error_page("No such user");
 }
 $logged_in_user = get_logged_in_user(false);
 page_head($user->name);
 start_table();
 echo "<tr><td valign=top>";
 start_table();
 show_user_summary_public($user);
 end_table();
 project_user_summary($user);
 show_other_projects($user, false);
 echo "</td><td valign=top>";
 start_table();
Exemple #5
0
    $offset = 0;
}
if ($offset < ITEM_LIMIT) {
    $cache_args = "sort_by={$sort_by}&offset={$offset}";
    $cacheddata = get_cached_data(TOP_PAGES_TTL, $cache_args);
    // Do we have the data in cache?
    //
    if ($cacheddata) {
        $data = unserialize($cacheddata);
        // use the cached data
    } else {
        //if not do queries etc to generate new data
        $data = get_top_participants($offset, $sort_by);
        //save data in cache
        //
        set_cached_data(TOP_PAGES_TTL, serialize($data), $cache_args);
    }
} else {
    error_page(tra("Limit exceeded - Sorry, first %1 items only", ITEM_LIMIT));
}
// Now display what we've got (either gotten from cache or from DB)
page_head(tra("Top participants"));
user_table_start($sort_by);
$i = 1 + $offset;
$n = sizeof($data);
foreach ($data as $user) {
    show_user_row($user, $i);
    $i++;
}
echo "</table>\n<p>";
if ($offset > 0) {
        $user->has_profile = 1;
    } else {
        error_page(tra("This user has no profile"));
    }
}
$logged_in_user = get_logged_in_user(false);
check_whether_to_show_profile($user, $logged_in_user);
$cache_args = "userid={$userid}";
$cacheddata = get_cached_data(USER_PROFILE_TTL, $cache_args);
if ($cacheddata) {
    // Already got a cached version of the information
    $community_links_object = unserialize($cacheddata);
} else {
    // Need to generate a new bunch of data
    $community_links_object = get_community_links_object($user);
    set_cached_data(USER_PROFILE_TTL, serialize($community_links_object), $cache_args);
}
page_head(tra("Profile: %1", $user->name));
start_table();
echo "<tr><td valign=\"top\">";
start_table();
show_profile($user, $logged_in_user);
end_table();
echo "</td><td valign=\"top\">";
start_table();
row2(tra("Account data"), "<a href=\"show_user.php?userid=" . $userid . "\">" . tra("View") . "</a>");
community_links($community_links_object, $logged_in_user);
end_table();
echo "</td></tr>";
end_table();
page_tail();
Exemple #7
0
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;
}
function get_runtime_info($appid)
{
    $info = unserialize(get_cached_data(3600, "get_runtime_info" . $appid));
    if ($info == false) {
        $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 = {$appid} \n            AND validate_state=1 \n            AND received_time > (unix_timestamp()-(3600*24)) \n            ");
        if (!$info) {
            // No recent jobs sound
            $info = new stdClass();
            $info->avg = $info->min = $info->max = $info->users = 0;
        }
        set_cached_data(3600, serialize($info), "get_runtime_info" . $appid);
    }
    return $info;
}
Exemple #9
0
$last_update = 0;
$row_array = null;
$cache_args = "level={$notification_level}";
if ($appid) {
    $cache_args .= "&appid={$appid}";
}
$cache_data = get_cached_data($cache_sec, $cache_args);
if ($cache_data && !$refresh_cache) {
    $cache_data = unserialize($cache_data);
    $last_update = $cache_data['last_update'];
    $row_array = $cache_data['row_array'];
} else {
    $row_array = get_error_wus();
    $last_update = time();
    $cache_data = array('last_update' => $last_update, 'row_array' => $row_array);
    set_cached_data($cache_sec, serialize($cache_data), $cache_args);
}
echo "<br/>";
echo "<form method=\"get\" action=\"errorwus.php\">\n";
print_checkbox("Hide canceled WUs", "hide_canceled", $hide_canceled);
print_checkbox("Hide WUs with only d/l errors", "hide_dlerr", $hide_dlerr);
if ($appid) {
    echo "<input type=\"hidden\" name=\"appid\" value=\"{$appid}\"/>";
}
echo "<input type=\"hidden\" name=\"level\" value=\"{$notification_level}\"/>";
echo "<input class=\"btn btn-default\" type=\"submit\" value=\"OK\">\n";
echo "</form>\n";
echo "Page last updated " . time_str($last_update);
if (!in_rops()) {
    echo "<form action=\"cancel_workunits_action.php\" method=\"post\">\n";
    echo "<input type=\"hidden\" name=\"back\" value=\"errorwus\"/>";
Exemple #10
0
if (!$offset) {
    $offset = 0;
}
if ($offset % $hosts_per_page) {
    $offset = 0;
}
if ($offset >= ITEM_LIMIT) {
    error_page(tra("Limit exceeded - Sorry, first %1 items only", ITEM_LIMIT));
}
$cache_args = "sort_by={$sort_by}&offset={$offset}";
$cacheddata = get_cached_data(TOP_PAGES_TTL, $cache_args);
if ($cacheddata) {
    $data = store_to_hosts($cacheddata);
} else {
    $data = get_top_hosts($offset, $sort_by);
    set_cached_data(TOP_PAGES_TTL, hosts_to_store($data), $cache_args);
}
// Now display what we've got (either gotten from cache or from DB)
//
page_head(tra("Top hosts"));
top_host_table_start($sort_by);
$i = 1 + $offset;
$n = sizeof($data);
foreach ($data as $host) {
    show_host_row($host, $i, false, true);
    $i++;
}
echo "</table>\n<p>";
if ($offset > 0) {
    $new_offset = $offset - $hosts_per_page;
    echo "<a href=top_hosts.php?sort_by={$sort_by}&amp;offset={$new_offset}>" . tra("Previous %1", $hosts_per_page) . "</a> | ";
Exemple #11
0
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
require_once "../inc/db.inc";
require_once "../inc/util.inc";
require_once "../inc/cache.inc";
check_get_args(array());
page_head(tra("Download BOINC add-on software"));
echo "\n    <p>" . tra("You can download applications in several categories.") . "\n    <ul>\n    <li>" . tra("These applications are not endorsed by %1 and you use them at your own risk.", PROJECT) . "\n    <li>" . tra("We do not provide instructions for installing these applications.\nHowever, the author may have provided some help on installing or uninstalling the application. \nIf this is not enough you should contact the author.") . tra("Instructions for installing and running BOINC are %1here%2.", "<a href=http://boinc.berkeley.edu/participate.php>", "</a>") . "<li>" . tra("This list is managed centrally at %1the BOINC website%2.", "<a href=\"http://boinc.berkeley.edu/addons.php\">", "</a>") . "\n    </ul>\n";
$httpFile = unserialize(get_cached_data(3600));
if (!$httpFile) {
    $httpFile = @file_get_contents("http://boinc.berkeley.edu/addons.php?strip_header=true");
    if ($httpFile) {
        set_cached_data(3600, serialize($httpFile));
    }
}
echo $httpFile;
echo "\n    <p><p>\n";
page_tail();
Exemple #12
0
function get_runtime_info($appid)
{
    $info = unserialize(get_cached_data(3600, "get_runtime_info" . $appid));
    if ($info == false) {
        $result = mysql_query("\n        Select 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        from (SELECT elapsed_time FROM `result` WHERE appid = {$appid} and validate_state =1 and received_time > (unix_timestamp()-(3600*24)) ORDER BY `received_time` DESC limit 100) t");
        $info = mysql_fetch_object($result);
        mysql_free_result($result);
        set_cached_data(3600, serialize($info), "get_runtime_info" . $appid);
    }
    return $info;
}
    $y = array(0, 0, 0, 0, 0, 0, 0, 0);
    foreach ($vendors as $name => $x) {
        if (!$name) {
            $name = "not reported by client";
        } else {
            $name = "<a href=android_tasks.php?vendor={$name}>{$name}</a>";
        }
        show_item($name, $x);
        $y[1] += $x[1];
        $y[3] += $x[3];
    }
    show_item("total", $y);
    end_table();
    page_tail();
}
$models = get_cached_data(86400);
if ($models) {
    $models = unserialize($models);
} else {
    $models = get_models();
    set_cached_data(86400, serialize($models));
}
$vendor = get_str("vendor", true);
if ($vendor) {
    uasort($models, 'compare');
    show_vendor($vendor, $models);
} else {
    $vendors = get_vendors($models);
    uasort($vendors, 'compare');
    show_vendors($vendors);
}