mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 19:28:41 +00:00
29 lines
564 B
PHP
29 lines
564 B
PHP
<?php
|
|
requirePHPLib('judger');
|
|
requirePHPLib('data');
|
|
|
|
if (!authenticateJudger()) {
|
|
UOJResponse::page404();
|
|
}
|
|
|
|
$res = DB::selectAll([
|
|
"select * from judger_info",
|
|
"where", [
|
|
["ip", "!=", ""],
|
|
"enabled" => true
|
|
]
|
|
]);
|
|
foreach ($res as $judger) {
|
|
$socket = fsockopen($judger['ip'], UOJConfig::$data['judger']['socket']['port']);
|
|
if ($socket === false) {
|
|
die("judge client {$judger['ip']} lost.");
|
|
}
|
|
fwrite($socket, json_encode([
|
|
'password' => UOJConfig::$data['judger']['socket']['password'],
|
|
'cmd' => 'update'
|
|
]));
|
|
fclose($socket);
|
|
}
|
|
|
|
die("ok");
|