function show_platforms()
{
    $path = "../cache/platform_list.xml";
    $mtime = @filemtime($path);
    if ($mtime && time() - $mtime < 3600) {
        @readfile($path);
    } else {
        require_once "../inc/db.inc";
        $retval = db_init_aux(true);
        if (!$retval) {
            $query = 'select name, user_friendly_name, plan_class from platform, app_version where app_version.platformid = platform.id and app_version.deprecated=0 group by name, plan_class';
            $result = mysql_query($query);
            $f = fopen($path, "w");
            fwrite($f, "<platforms>\n");
            while ($p = mysql_fetch_object($result)) {
                if ($p->plan_class) {
                    $pc = "   <plan_class>{$p->plan_class}</plan_class>\n";
                } else {
                    $pc = "";
                }
                fwrite($f, "  <platform>\n    <platform_name>{$p->name}</platform_name>\n    <user_friendly_name>{$p->user_friendly_name}</user_friendly_name>\n{$pc}  </platform>\n");
            }
            mysql_free_result($result);
            fwrite($f, "</platforms>\n");
            fclose($f);
            @readfile($path);
        }
    }
}
Example #2
0
    $pid = parse_element($thisxml, "<pid_file>");
    if (!$pid) {
        $pid = $cmd . ".pid";
    }
    $disabled = parse_element($thisxml, "<disabled>");
    // surrogate for command
    list($c) = explode(".", $log);
    show_daemon_status($host, $pid, $c, $disabled);
}
$xmlstring = "  </daemon_status>\n  <database_file_states>\n";
if ($xml) {
    echo $xmlstring;
} else {
    echo "\n        <tr><td align=right><b>" . tra("Running:") . "</b></td>\n        <td colspan=2>" . tra("Program is operating normally") . "</td></tr>\n        <tr><td align=right><b>" . tra("Not Running:") . "</b></td>\n        <td colspan=2>" . tra("Program failed or the project is down") . "</td></tr>\n        <tr><td align=right><b>" . tra("Disabled:") . "</b></td>\n        <td colspan=2>" . tra("Program is disabled") . "</td></tr>\n        </table>\n        </td>\n        <td valign=top>\n        <h2>" . tra("Computing status") . "</h2>\n    ";
}
$retval = db_init_aux();
if ($retval) {
    echo tra("The database server is not accessible");
} else {
    if (!$xml) {
        echo "<table border=0 cellpadding=0 cellspacing=0><tr><td>\n            <table border=0 cellpadding=4>\n            <tr><th>" . tra("Work") . "</th><th>#</th></tr>\n        ";
    }
    // If you are reading these values from a file rather than
    // making live queries to the database, do something like this:
    //
    // $sendfile = "/home/boincadm/server_status_data/count_results_unsent.out";
    // $n = `/bin/tail -1 $sendfile`;
    // show_counts("Tasks ready to send","results_ready_to_send",$n);
    show_counts(tra("Tasks ready to send"), "results_ready_to_send", get_mysql_count("result", "server_state = 2"));
    show_counts(tra("Tasks in progress"), "results_in_progress", get_mysql_count("result", "server_state = 4"));
    show_counts(tra("Workunits waiting for validation"), "workunits_waiting_for_validation", get_mysql_count("workunit", "need_validate=1"));
Example #3
0
<?php

// fix DB damage caused by a bug introduced in [21181].
// If you ran a server using code between this and [21812], run this script.
$cli_only = true;
require_once "../inc/db.inc";
set_time_limit(0);
db_init_aux();
$config = get_config();
$mjd = parse_element($config, "daily_result_quota");
if (!$mjd) {
    $mjd = 100;
}
function do_query($query)
{
    echo "Doing query:\n{$query}\n";
    $result = mysql_query($query);
    if (!$result) {
        echo "Failed:\n" . mysql_error() . "\n";
    } else {
        echo "Success.\n";
    }
}
do_query("update host_app_version set turnaround_var=0, turnaround_q=0");
do_query("update host_app_version set max_jobs_per_day={$mjd} where max_jobs_per_day>{$mjd} or max_jobs_per_day<0");
do_query("update host_app_version set consecutive_valid=0 where consecutive_valid<0 or consecutive_valid>1000");