static function waitForChilds($end = false) { if (!$end) { $maxchilds = Options::get("fork"); } else { $maxchilds = 0; } while (self::$childs >= $maxchilds) { CliDebug::info("Jobserver: Waiting for childs (childs=self::{$childs})\n"); $s = false; $pid = pcntl_wait($s, WNOHANG); $status = pcntl_wexitstatus($s); while (!$pid) { self::systemStats(2); $pid = pcntl_wait($s, WNOHANG); $status = pcntl_wexitstatus($s); } if ($status == 0) { self::$childs--; CliDebug::info("Jobserver: Child exited (childs=self::{$childs})\n"); return false; } else { foreach (self::$childpids as $pid) { posix_kill($pid, SIGTERM); } \App\Presenters\BasePresenter::mexit(2, "One child died! Exiting!\n"); } } }
public static function read($params = array(), $from = PHP_SAPI) { foreach (self::$confparams as $parm => $arr) { self::parseOne($params, $parm, $arr[0], $parm, $arr[4], $arr[1], $arr[2], $arr[3], $from); } foreach ($params as $param => $value) { if ($param == "action") { continue; } if ($param == "error") { continue; } $found = false; foreach (self::$confparams as $key => $cparam) { if ($param == $key || $param == $cparam[0]) { $found = true; continue; } } if (!$found) { Debugger::log("Unknown parameter {$param}!\n", Debugger::WARNING); } } self::$opts->start = TimeUtils::timetoseconds(self::$opts->start); if (self::$opts->start < 631148400) { BasePresenter::mexit(4, sprintf("Bad start time (%d)?!\n", date("Y-m-d", self::$opts->start))); } }