@@ -273,9 +273,11 @@ private function loop(): void
273273 // indicating that we didn't find any child to be
274274 // reaped
275275 if ($ errno != 10 ) {
276- logmsg (LOG_WARNING ,
276+ logmsg (
277+ LOG_WARNING ,
277278 "pcntl_waitpid returned $ ret when trying to reap child processes: "
278- . pcntl_strerror ($ errno ));
279+ . pcntl_strerror ($ errno )
280+ );
279281 }
280282 }
281283
@@ -322,7 +324,7 @@ private function loop(): void
322324 $ judgehosts = $ this ->request ('judgehosts ' , 'GET ' );
323325 if ($ judgehosts !== null ) {
324326 $ judgehosts = dj_json_decode ($ judgehosts );
325- $ judgehost = array_values (array_filter ($ judgehosts , fn ($ j ) => $ j ['hostname ' ] === $ this ->myhost ))[0 ];
327+ $ judgehost = array_values (array_filter ($ judgehosts , fn ($ j ) => $ j ['hostname ' ] === $ this ->myhost ))[0 ];
326328 if (!isset ($ judgehost ['enabled ' ]) || !$ judgehost ['enabled ' ]) {
327329 logmsg (LOG_WARNING , "Judgehost needs to be enabled in web interface. " );
328330 }
@@ -467,8 +469,11 @@ private function handleDebugInfoTask(array $row, ?string &$lastWorkdir, string $
467469 }
468470
469471 $ this ->request (
470- sprintf ('judgehosts/add-debug-info/%s/%s ' , urlencode ($ this ->myhost ),
471- urlencode ((string )$ judgeTask ['judgetaskid ' ])),
472+ sprintf (
473+ 'judgehosts/add-debug-info/%s/%s ' ,
474+ urlencode ($ this ->myhost ),
475+ urlencode ((string )$ judgeTask ['judgetaskid ' ])
476+ ),
472477 'POST ' ,
473478 ['full_debug ' => $ this ->restEncodeFile ($ tmpfile , false )],
474479 false
@@ -480,8 +485,11 @@ private function handleDebugInfoTask(array $row, ?string &$lastWorkdir, string $
480485 // Retrieving full team output for a particular testcase.
481486 $ testcasedir = $ workdir . "/testcase " . sprintf ('%05d ' , $ judgeTask ['testcase_id ' ]);
482487 $ this ->request (
483- sprintf ('judgehosts/add-debug-info/%s/%s ' , urlencode ($ this ->myhost ),
484- urlencode ((string )$ judgeTask ['judgetaskid ' ])),
488+ sprintf (
489+ 'judgehosts/add-debug-info/%s/%s ' ,
490+ urlencode ($ this ->myhost ),
491+ urlencode ((string )$ judgeTask ['judgetaskid ' ])
492+ ),
485493 'POST ' ,
486494 ['output_run ' => $ this ->restEncodeFile ($ testcasedir . '/program.out ' , false )],
487495 false
@@ -532,8 +540,10 @@ private function handleTask(string $type, array $row, ?string &$lastWorkdir, str
532540 }
533541 $ this ->endpoint ['retrying ' ] = false ;
534542
535- logmsg (LOG_INFO ,
536- "⇝ Received " . sizeof ($ row ) . " ' " . $ type . "' judge tasks (endpoint " . $ this ->endpoint ['id ' ] . ") " );
543+ logmsg (
544+ LOG_INFO ,
545+ "⇝ Received " . sizeof ($ row ) . " ' " . $ type . "' judge tasks (endpoint " . $ this ->endpoint ['id ' ] . ") "
546+ );
537547
538548 if ($ type == 'prefetch ' ) {
539549 $ this ->handlePrefetchTask ($ row , $ lastWorkdir , $ workdirpath );
@@ -574,10 +584,12 @@ private function checkDiskSpace(string $workdirpath): void
574584 $ candidateDirs [] = $ workdirpath . "/ " . $ subdir ;
575585 }
576586 }
577- uasort ($ candidateDirs , fn ($ a , $ b ) => filemtime ($ a ) <=> filemtime ($ b ));
587+ uasort ($ candidateDirs , fn ($ a , $ b ) => filemtime ($ a ) <=> filemtime ($ b ));
578588 $ after = $ before = disk_free_space (JUDGEDIR );
579- logmsg (LOG_INFO ,
580- "🗑 Low on diskspace, cleaning up ( " . count ($ candidateDirs ) . " potential candidates). " );
589+ logmsg (
590+ LOG_INFO ,
591+ "🗑 Low on diskspace, cleaning up ( " . count ($ candidateDirs ) . " potential candidates). "
592+ );
581593 $ cnt = 0 ;
582594 foreach ($ candidateDirs as $ d ) {
583595 $ cnt ++;
@@ -590,7 +602,9 @@ private function checkDiskSpace(string $workdirpath): void
590602 break ;
591603 }
592604 }
593- logmsg (LOG_INFO , "🗑 Cleaned up $ cnt old judging directories; reduced disk space by " .
605+ logmsg (
606+ LOG_INFO ,
607+ "🗑 Cleaned up $ cnt old judging directories; reduced disk space by " .
594608 sprintf ("%01.2fMB. " , ($ after - $ before ) / (1024 * 1024 ))
595609 );
596610 }
@@ -851,7 +865,9 @@ private function runCommandSafe(array $command_parts, &$retval = DONT_CARE, $log
851865
852866 logmsg (LOG_DEBUG , "Executing command: $ command " );
853867 system ($ command , $ retval_local );
854- if ($ retval !== DONT_CARE ) $ retval = $ retval_local ; // phpcs:ignore Generic.ControlStructures.InlineControlStructure.NotAllowed
868+ if ($ retval !== DONT_CARE ) {
869+ $ retval = $ retval_local ;
870+ } // phpcs:ignore Generic.ControlStructures.InlineControlStructure.NotAllowed
855871
856872 if ($ retval_local !== 0 ) {
857873 if ($ log_nonzero_exitcode ) {
@@ -877,8 +893,10 @@ private function fetchExecutable(
877893 if ($ buildlogpath !== null ) {
878894 $ extra_log = dj_file_get_contents ($ buildlogpath , 4096 );
879895 }
880- logmsg (LOG_ERR ,
881- "Fetching executable failed for $ type script ' $ execid': " . $ error );
896+ logmsg (
897+ LOG_ERR ,
898+ "Fetching executable failed for $ type script ' $ execid': " . $ error
899+ );
882900 $ description = "$ execid: fetch, compile, or deploy of $ type script failed. " ;
883901 $ this ->disable (
884902 $ type . '_script ' ,
@@ -939,11 +957,11 @@ private function fetchExecutableInternal(
939957 ];
940958 }
941959 unset($ files );
942- uasort ($ filesArray , fn (array $ a , array $ b ) => strcmp ($ a ['filename ' ], $ b ['filename ' ]));
960+ uasort ($ filesArray , fn (array $ a , array $ b ) => strcmp ($ a ['filename ' ], $ b ['filename ' ]));
943961 $ computedHash = md5 (
944962 join (
945963 array_map (
946- fn ($ file ) => $ file ['hash ' ] . $ file ['filename ' ] . $ file ['is_executable ' ],
964+ fn ($ file ) => $ file ['hash ' ] . $ file ['filename ' ] . $ file ['is_executable ' ],
947965 $ filesArray
948966 )
949967 )
@@ -1448,7 +1466,8 @@ private function runTestcase(
14481466 $ judgeTask ['run_script_id ' ],
14491467 $ run_config ['hash ' ],
14501468 $ judgeTask ['judgetaskid ' ],
1451- $ combined_run_compare );
1469+ $ combined_run_compare
1470+ );
14521471 if (isset ($ error )) {
14531472 return false ;
14541473 }
@@ -1532,7 +1551,8 @@ private function runTestcase(
15321551 $ run_command_parts [] = '-n ' ;
15331552 $ run_command_parts [] = $ this ->options ['daemonid ' ];
15341553 }
1535- array_push ($ run_command_parts ,
1554+ array_push (
1555+ $ run_command_parts ,
15361556 $ input ,
15371557 $ output ,
15381558 $ timelimit_str ,
@@ -1677,8 +1697,11 @@ private function reportJudgingRun(array $judgeTask, array $new_judging_run, bool
16771697 dj_sleep (0.001 * $ sleep_ms );
16781698 }
16791699 $ response = $ this ->request (
1680- sprintf ('judgehosts/add-judging-run/%s/%s ' , $ new_judging_run ['hostname ' ],
1681- urlencode ((string )$ judgeTaskId )),
1700+ sprintf (
1701+ 'judgehosts/add-judging-run/%s/%s ' ,
1702+ $ new_judging_run ['hostname ' ],
1703+ urlencode ((string )$ judgeTaskId )
1704+ ),
16821705 'POST ' ,
16831706 $ new_judging_run ,
16841707 false
0 commit comments