function scan_batches()
{
    $batches = BoincBatch::enum("", "order by id");
    foreach ($batches as $b) {
        process_batch($b);
    }
}
Beispiel #2
0
function show_batches($user)
{
    $batches = BoincBatch::enum("user_id={$user->id}");
    page_head("Batches");
    start_table();
    table_header("Batch ID", "Submitted", "# jobs");
    foreach ($batches as $batch) {
        echo "<tr>\n            <td><a href=submit_status.php?action=show_batch&batch_id={$batch->id}>{$batch->id}</a></td>\n            <td>" . time_str($batch->create_time) . "</td>\n            <td>{$batch->njobs}</td>\n            </tr>\n        ";
    }
    end_table();
    page_tail();
}
Beispiel #3
0
function batches_action($app)
{
    $batches = BoincBatch::enum("app_id={$app->id}");
    $abort_all = get_str("abort_all", true);
    foreach ($batches as $batch) {
        if ($abort_all || get_str("abort_{$batch->id}", true)) {
            abort_batch($batch);
        }
    }
    page_head("Update successful");
    echo "\n        <a href=manage_app.php?app_id={$app->id}>Return to application management page</a>\n    ";
    page_tail();
}
Beispiel #4
0
function query_batches($r)
{
    xml_start_tag("query_batches");
    list($user, $user_submit) = authenticate_user($r, null);
    $batches = BoincBatch::enum("user_id = {$user->id}");
    $get_cpu_time = (int) $r->get_cpu_time;
    foreach ($batches as $batch) {
        if ($batch->state < BATCH_STATE_COMPLETE) {
            $wus = BoincWorkunit::enum("batch = {$batch->id}");
            $batch = get_batch_params($batch, $wus);
        }
        echo "    <batch>\n";
        print_batch_params($batch, $get_cpu_time);
        echo "   </batch>\n";
    }
    echo "</query_batches>\n";
}
Beispiel #5
0
function handle_show_all($user)
{
    $userid = get_int("userid");
    $appid = get_int("appid");
    $state = get_int("state");
    if ($userid) {
        // user looking at their own batches
        //
        if ($userid != $user->id) {
            error_page("wrong user");
        }
        $batches = BoincBatch::enum("user_id = {$user->id} and state={$state} order by id desc");
        fill_in_app_and_user_names($batches);
        show_batches_in_state($batches, $state);
    } else {
        // admin looking at batches
        //
        check_admin_access($user, $appid);
        if ($appid) {
            $app = BoincApp::lookup_id($appid);
            if (!$app) {
                error_page("no such app");
            }
            $batches = BoincBatch::enum("app_id = {$appid} and state={$state} order by id desc");
        } else {
            $batches = BoincBatch::enum("state={$state} order by id desc");
        }
        fill_in_app_and_user_names($batches);
        show_batches_in_state($batches, $state);
    }
}
Beispiel #6
0
function handle_admin($user)
{
    $app_id = get_int("app_id");
    $user_submit = BoincUserSubmit::lookup_userid($user->id);
    if (!$user_submit) {
        error_page("no access");
    }
    if ($app_id) {
        if (!$user_submit->manage_all) {
            $usa = BoincUserSubmitApp::lookup("user_id = {$user->id} and app_id={$app_id}");
            if (!$usa) {
                error_page("no access");
            }
        }
        $app = BoincApp::lookup_id($app_id);
        if (!$app) {
            error_page("no such app");
        }
        page_head("Administer {$app->user_friendly_name}");
        $batches = BoincBatch::enum("app_id = {$app_id} order by id desc");
        show_batches($batches);
    } else {
        if (!$user_submit->manage_all) {
            error_page("no access");
        }
        page_head("Administer all apps");
        $batches = BoincBatch::enum("true order by id desc");
        show_batches($batches);
    }
    page_tail();
}