function updateTestdata($prob_name) { $path = Config::getInstance()->getVar('path'); $testdata_path = $path['testdata'] . $prob_name . '/'; $rs = getTestdataVersion($prob_name); if ($rs['version'] != 0) { $xml = file_get_contents($testdata_path . 'config.xml'); $data_config = BFL_XML::XML2Array($xml); if ($data_config['checker']['type'] == 'custom' && $data_config['checker']['custom']['language'] != '') { //compile checker chdir($testdata_path); $compiler_path = $path['compiler']; $language = $data_config['checker']['custom']['language']; $source_file = $data_config['checker']['custom']['source']; $binary_file = $data_config['checker']['name']; $command = "{$compiler_path}compiler {$compiler_path}config.ini {$language} {$source_file} {$binary_file}"; list($result, $option) = exec($command); $rs = getTestdataVersion($prob_name); if ($result == 0) { $rs['checker_compile'] = 1; } if (file_exists('compile_message.txt')) { unlink('compile_message.txt'); } } } return $rs; }
function action_getTestdataVersion($prob_name) { include 'module/data/data.php'; return getTestdataVersion($prob_name); }