public function __init($directory = NULL, $email = NULL, BlueScreen $blueScreen = NULL) { if (!$directory) { $directory = __DIR__ . "/../log/"; } if (getenv("MONDA_DEBUG")) { if (array_key_exists(getenv("MONDA_DEBUG"), self::$levels)) { self::$loglevel = self::$levels[getenv("MONDA_DEBUG")]; Debugger::$productionMode = false; } else { self::log("Unknown log level!\n", Debugger::ERROR); } } else { if (Options::get("debug")) { if (array_key_exists(Options::get("debug"), self::$levels)) { self::$loglevel = self::$levels[Options::get("debug")]; Debugger::$productionMode = false; } else { self::log("Unknown log level!\n", Debugger::ERROR); } } } self::$wwwlogger = new \Tracy\Logger($directory, $email, $blueScreen); if (PHP_SAPI == "cli") { if (Options::get("logfile")) { self::$logfd = fopen(Options::get("logfile"), "w"); } else { self::$logfd = STDERR; } } }
static function cquery($query) { $args = func_get_args(); $ckey = md5(serialize($args)); $ret = self::$sqlcache->load($ckey); if ($ret === null) { $ret = self::zquery($args)->fetchAll(); self::$sqlcache->save($ckey, $ret, array(Nette\Caching\Cache::EXPIRE => Options::get("sqlcacheexpire"))); } return $ret; }
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 function Help($extended = false) { $this->helpModule(); $this->helpActions(); $this->helpHints(); if ($this->name != 'Default') { if (Options::get("xhelp")) { $this->helpOptions($this->name); } } else { if (Options::get("xhelp")) { $this->helpOptions(false); } } self::mexit(); }