Example #1
0
 function write_body()
 {
     // TODO: filters?
     $this->write_messages('judge');
     JudgeDaemon::cleanup();
     $this->write_judges(JudgeDaemon::all());
 }
Example #2
0
 public function set_status_all($new_status)
 {
     if (!JudgeDaemon::is_valid_status($new_status)) {
         throw new Exception("Invalid status code: {$new_status}");
     }
     static $query;
     DB::prepare_query($query, "UPDATE `judge_daemon` SET `status` = ?");
     $query->execute(array($new_status));
     $query->closeCursor();
 }
Example #3
0
<?php

require_once '../lib/bootstrap.inc';
require_once '../lib/DateRange.php';
// -----------------------------------------------------------------------------
// Configuration
// -----------------------------------------------------------------------------
if (!isset($_SERVER['argv'])) {
    die("The judgedaemon must be started from the console.");
}
define('VERBOSE', true);
// Identity of this host (database object)
$self = JudgeDaemon::add();
// -----------------------------------------------------------------------------
// Welcome message
// -----------------------------------------------------------------------------
if (VERBOSE) {
    echo "+=============================================================================+\n";
    echo "|                  __                   __     _    __     _                  |\n";
    echo "|                 / /  __  __   _____  / /_   (_)  / /_   (_)  ____ _         |\n";
    echo "|            __  / /  / / / /  / ___/ / __/  / /  / __/  / /  / __ `/         |\n";
    echo "|           / /_/ /  / /_/ /  (__  ) / /_   / /  / /_   / /  / /_/ /          |\n";
    echo "|           \\____/   \\__,_/  /____/  \\__/  /_/   \\__/  /_/   \\__,_/           |\n";
    echo "|                                                                             |\n";
    echo "|       Judge daemon   on " . sprintf('%-20s', $self->name) . "                                |\n";
    echo "|                                                                             |\n";
    echo "+=============================================================================+\n";
}
// -----------------------------------------------------------------------------
// Main loop
// -----------------------------------------------------------------------------