/** * Internal error reporting (back from judgehost) */ function internal_error_POST($args) { global $DB; checkargs($args, array('description', 'judgehostlog', 'disabled')); global $cdatas, $api; // group together duplicate internal errors // note that it may be good to be able to ignore fields here, e.g. judgingid with compile errors $errorid = $DB->q('MAYBEVALUE SELECT errorid FROM internal_error WHERE description=%s AND disabled=%s AND status=%s' . (isset($args['cid']) ? ' AND cid=%i' : '%_'), $args['description'], $args['disabled'], 'open', $args['cid']); if (isset($errorid)) { // FIXME: in some cases it makes sense to extend the known information, e.g. the judgehostlog return $errorid; } $errorid = $DB->q('RETURNID INSERT INTO internal_error (judgingid, cid, description, judgehostlog, time, disabled) VALUES (%i, %i, %s, %s, %i, %s)', $args['judgingid'], $args['cid'], $args['description'], $args['judgehostlog'], now(), $args['disabled']); $disabled = dj_json_decode($args['disabled']); // disable what needs to be disabled set_internal_error($disabled, $args['cid'], 0); if (in_array($disabled['kind'], array('problem', 'language'))) { // give back judging if we have to $submitid = $DB->q('VALUE SELECT submitid FROM judging WHERE judgingid = %i', $args['judgingid']); give_back_judging($args['judgingid'], $submitid); } return $errorid; }
$edata = $DB->q('TUPLE SELECT * FROM internal_error WHERE errorid=%i', $id); if (!$edata) { error("Missing internal error data for e" . $id); } $disabled = dj_json_decode($edata['disabled']); if (isset($_REQUEST['ignore']) || isset($_REQUEST['resolve'])) { if (isset($_REQUEST['ignore'])) { $status = "ignored"; } if (isset($_REQUEST['resolve'])) { $status = "resolved"; } $DB->q('UPDATE internal_error SET status=%s WHERE errorid=%i', $status, $id); if ($status == 'resolved') { set_internal_error($disabled, $edata['cid'], 1); } auditlog('internal_error', $id, 'internal error: ' + $status, ''); header('Location: internal_error.php?id=' . urlencode($id)); } require LIBWWWDIR . '/header.php'; echo '<br/><h1>Internal Error e' . $id . "</h1>\n\n"; echo "<table>\n"; echo "<tr><td>Description:</td><td>"; if (empty($edata['description'])) { echo '<span class="nodata">none</span>'; } else { echo specialchars($edata['description']); } echo "</td></tr>\n"; echo "<tr><td>Time:</td><td>" . printtime($edata['time']) . "</td></tr>\n";