コード例 #1
0
function do_waiting_queues()
{
    global $project, $code_url;
    $round = get_Round_for_project_state($project->state);
    if (is_null($round)) {
        return;
    }
    if ($project->state != $round->project_waiting_state) {
        return;
    }
    // Okay, so the project is in some round's waiting state.
    // What queues is it in, if any?
    echo "<h4>";
    echo _("Queues");
    echo "</h4>\n";
    $res = mysql_query("\n        SELECT name, project_selector\n        FROM queue_defns\n        WHERE round_id='{$round->id}'\n        ORDER BY ordering\n    ") or die(mysql_error());
    if (mysql_num_rows($res) == 0) {
        // No queues defined for this round.
        echo sprintf(_('There are no queues defined for round %s, so this project should be automatically released within a few minutes.'), $round->id);
    } else {
        echo sprintf(_('This project is in the following round %s queues:'), $round->id);
        echo "<br>\n";
        echo "<ul>\n";
        $n_queues = 0;
        while (list($q_name, $q_project_selector) = mysql_fetch_row($res)) {
            $cooked_project_selector = cook_project_selector($q_project_selector);
            $res2 = mysql_query("\n                SELECT projectid\n                FROM projects\n                WHERE projectid='{$project->projectid}' AND ({$cooked_project_selector})\n            ") or die(mysql_error());
            if (mysql_num_rows($res2) > 0) {
                $n_queues += 1;
                $enc_q_name = urlencode($q_name);
                $url = "{$code_url}/stats/release_queue.php?round_id={$round->id}&name={$enc_q_name}";
                $enc_url = html_safe($url);
                echo "<li><a href='{$enc_url}'>{$q_name}</a></li>\n";
            }
        }
        if ($n_queues == 0) {
            echo "<li>" . _("(none)") . "</li>\n";
        }
        echo "</ul>\n";
    }
    if (project_has_a_hold_in_state($project->projectid, $project->state)) {
        echo "<p>", _("However, this project is currently being held-in-waiting; it will not be auto-released until the hold is removed."), "</p>\n";
    }
}
コード例 #2
0
     Page_reclaim($projectid, $image, $round, '[automodify.php]');
 }
 // Decide whether the project is finished its current round.
 if ($state == $round->project_available_state) {
     $num_done_pages = Project_getNumPagesInState($projectid, $round->page_save_state);
     $num_total_pages = Project_getNumPages($projectid);
     if ($num_done_pages != $num_total_pages) {
         if ($verbose) {
             echo "    Only {$num_done_pages} of {$num_total_pages} pages are in '{$round->page_save_state}'.\n";
         }
         continue;
     }
     if ($verbose) {
         echo "    All {$num_total_pages} pages are in '{$round->page_save_state}'.\n";
     }
     if (project_has_a_hold_in_state($projectid, $state)) {
         if ($verbose) {
             echo "    Normally, this project would now advance to {$round->project_complete_state},\n";
             echo "    but it has a hold in {$state}, so it stays where it is.\n";
         }
         continue;
     }
     $state = $round->project_complete_state;
     if ($verbose) {
         echo "    Advancing \"{$nameofwork}\" to {$state}\n";
     }
     $error_msg = project_transition($projectid, $state, PT_AUTO);
     if ($error_msg) {
         echo "{$error_msg}\n";
         continue;
     }