@@ -240,7 +240,7 @@ private function initialize(): void
240240 $ domserver_languages = dj_json_decode ($ this ->request ('languages ' , 'GET ' ));
241241 foreach ($ domserver_languages as $ language ) {
242242 $ id = $ language ['id ' ];
243- if (key_exists ($ id , $ this ->langexts )) {
243+ if (array_key_exists ($ id , $ this ->langexts )) {
244244 $ this ->langexts [$ id ] = $ language ['extensions ' ];
245245 }
246246 }
@@ -551,7 +551,7 @@ private function handleTask(string $type, array $row, ?string &$lastWorkdir, str
551551 $ this ->endpoints [$ this ->endpointID ]['retrying ' ] = false ;
552552
553553 logmsg (LOG_INFO ,
554- "⇝ Received " . sizeof ($ row ) . " ' " . $ type . "' judge tasks (endpoint $ this ->endpointID ) " );
554+ "⇝ Received " . count ($ row ) . " ' " . $ type . "' judge tasks (endpoint $ this ->endpointID ) " );
555555
556556 if ($ type == 'prefetch ' ) {
557557 $ this ->handlePrefetchTask ($ row , $ lastWorkdir , $ workdirpath );
@@ -763,14 +763,14 @@ private function request(string $url, string $verb = 'GET', $data = '', bool $fa
763763 }
764764 }
765765 if ($ trial == BACKOFF_STEPS ) {
766- $ errstr = $ errstr . " Retry limit reached. " ;
766+ $ errstr .= " Retry limit reached. " ;
767767 } else {
768768 $ retry_in_sec = $ delay_in_sec + BACKOFF_JITTER_SEC * random_int (0 , mt_getrandmax ()) / mt_getrandmax ();
769769 $ warnstr = $ errstr . " This request will be retried after about " .
770770 round ($ retry_in_sec , 2 ) . "sec... ( " . $ trial . "/ " . BACKOFF_STEPS . ") " ;
771771 warning ($ warnstr );
772772 dj_sleep ($ retry_in_sec );
773- $ delay_in_sec = $ delay_in_sec * BACKOFF_FACTOR ;
773+ $ delay_in_sec *= BACKOFF_FACTOR ;
774774 }
775775 }
776776 if (!$ succeeded ) {
@@ -865,7 +865,7 @@ private function runCommandSafe(array $command_parts, &$retval = DONT_CARE, $log
865865 return false ;
866866 }
867867
868- $ command = implode (' ' , array_map (' dj_escapeshellarg ' , $ command_parts ));
868+ $ command = implode (' ' , array_map (dj_escapeshellarg (...) , $ command_parts ));
869869
870870 logmsg (LOG_DEBUG , "Executing command: $ command " );
871871 system ($ command , $ retval_local );
@@ -917,7 +917,7 @@ private function fetchExecutableInternal(
917917 string $ hash ,
918918 bool $ combined_run_compare = false
919919 ): array {
920- $ execdir = join ('/ ' , [
920+ $ execdir = implode ('/ ' , [
921921 $ workdirpath ,
922922 'executable ' ,
923923 $ type ,
@@ -959,8 +959,8 @@ private function fetchExecutableInternal(
959959 unset($ files );
960960 uasort ($ filesArray , fn (array $ a , array $ b ) => strcmp ($ a ['filename ' ], $ b ['filename ' ]));
961961 $ computedHash = md5 (
962- join (
963- array_map (
962+ implode (
963+ '' , array_map (
964964 fn ($ file ) => $ file ['hash ' ] . $ file ['filename ' ] . $ file ['is_executable ' ],
965965 $ filesArray
966966 )
@@ -1767,10 +1767,10 @@ private function fetchTestcase(string $workdirpath, string $testcase_id, int $ju
17671767
17681768 private function initsignals (): void
17691769 {
1770- pcntl_signal (SIGTERM , [ self ::class, ' signalHandler ' ] );
1771- pcntl_signal (SIGINT , [ self ::class, ' signalHandler ' ] );
1772- pcntl_signal (SIGHUP , [ self ::class, ' signalHandler ' ] );
1773- pcntl_signal (SIGUSR1 , [ self ::class, ' signalHandler ' ] );
1770+ pcntl_signal (SIGTERM , self ::signalHandler (...) );
1771+ pcntl_signal (SIGINT , self ::signalHandler (...) );
1772+ pcntl_signal (SIGHUP , self ::signalHandler (...) );
1773+ pcntl_signal (SIGUSR1 , self ::signalHandler (...) );
17741774 }
17751775}
17761776
0 commit comments