static function findDeps(&$tasks, &$auxdeps) { if (count($tasks) === 0) { return; } global $wgManiphestListArcanistPath; global $wgManiphestListConduitURI; global $wgManiphestListConduitToken; $arcopts = '--conduit-uri \'' . $wgManiphestListConduitURI . '\''; $arcopts .= ' --conduit-token \'' . $wgManiphestListConduitToken . '\''; $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w")); $query_command = "{$wgManiphestListArcanistPath} {$arcopts} call-conduit maniphest.query"; $h = proc_open($query_command, $descriptorspec, $pipes, null, null); if (!is_resource($h)) { die("Error while calling arcanist."); } $conduit_command = sprintf('{ "phids":[ %s ] }', implode(",", array_map("ManiphestListCommand::addQuotes", array_keys($tasks)))); fwrite($pipes[0], $conduit_command); fflush($pipes[0]); fclose($pipes[0]); $response = ""; while ($s = fread($pipes[1], 1024)) { $response .= $s; } #while($s = fread($pipes[2], 1024)) { # $response .= $s; #} #error_log($response); proc_close($h); $l = strpos($response, "{"); $r = strrpos($response, "}"); if ($l === FALSE || $r === FALSE) { $response = ""; } $response = substr($response, $l, $l + $r + 1); ManiphestListCommand::parseDeps(json_decode($response, true), $tasks); # aux dependencies (subsequent lookup) $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w")); $query_command = "{$wgManiphestListArcanistPath} {$arcopts} call-conduit maniphest.query"; $h = proc_open($query_command, $descriptorspec, $pipes, null, null); if (!is_resource($h)) { die("Error while calling arcanist."); } $aux = array(); foreach ($tasks as $phid => $t) { $aux = array_merge($aux, $t['deps']); } $conduit_command = sprintf('{ "phids":[ %s ] }', implode(",", array_map("ManiphestListCommand::addQuotes", $aux))); fwrite($pipes[0], $conduit_command); fflush($pipes[0]); fclose($pipes[0]); $response = ""; while ($s = fread($pipes[1], 1024)) { $response .= $s; } #while($s = fread($pipes[2], 1024)) { # $response .= $s; #} #error_log($response); proc_close($h); $l = strpos($response, "{"); $r = strrpos($response, "}"); if ($l === FALSE || $r === FALSE) { $response = ""; } $response = substr($response, $l, $l + $r + 1); ManiphestListCommand::parseAux(json_decode($response, true), $wgManiphestListConduitURI, $auxdeps); }