public function ACT_source() { $record_id = $this->path_option->getPathSection(2); $record = new MDL_Record($record_id); if (!$record->canViewSource()) { $this->deny(); } $this->view->record = $record; $this->view->display('record/source.php'); }
public function ACT_rejudge() { $record_id = $this->path_option->getVar('record_id'); if ($record_id !== false) { $record = new MDL_Record($record_id); if (!$record->judgeStopped()) { throw new MDL_Exception_Judge(MDL_Exception_Judge::ALREADY_RUNNING); } MDL_Judge_Single::rejudgeSingle($record_id); $this->locator->redirect('record_detail', array(), '/' . $record_id); } $prob_id = $this->path_option->getVar('prob_id'); if ($prob_id !== false) { MDL_Judge_Single::rejudgeProblem(new MDL_Problem($prob_id)); $this->locator->redirect('admin_problem_list'); } }
public static function stop($record_id) { $record = new MDL_Record($record_id); $judger_id = $record->getJudger()->getID(); $record_meta = $record->getInfo()->getRecordMeta(); $status = $record_meta->getVar('status'); if ($status == MDL_Judge_Record::STATUS_STOPPED) { return; } $record_meta->setVar('status', MDL_Judge_Record::STATUS_STOPPED); $record_meta->setVar('result_text', MDL_Judge_Record::RESULT_EXECUTOR_ERROR); $task_name = $record->getTaskName(); if ($judger_id != 0) { MDL_Judger_Access::stopJudge($task_name, $record->getJudger()); if ($status != MDL_Judge_Record::STATUS_WAITING) { $record->getJudger()->unlock(); } } }
public static function recordComplete($info) { $record = new MDL_Record($info['record_id'], MDL_Record::GET_ALL); $record_meta = $record->getInfo()->getRecordMeta(); if ($record_meta->getVar('status') == self::STATUS_STOPPED) { return; } $meta = array('result_text' => $info['fatal'], 'status' => self::STATUS_STOPPED, 'time' => $info['time'], 'memory' => $info['memory'], 'score' => $info['score']); $record_meta->setVars($meta); //unlock judger $judger = $record->getJudger(); $judger->unlock(); //process task queue MDL_Judger_Process::processTaskQueue(); }
public function addRecord($record_id) { $records = $this->getRecords(); $record_ids = array(); foreach ($records as $record) { $record_ids[] = $record->getID(); } $record_ids[] = $record_id; $this->getMeta()->setVar('records', implode(',', $record_ids)); $record = new MDL_Record($record_id); $this->last_record[$record->getProblem()->getID()] = $record; }