Beispiel #1
0
 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;
         }
     }
 }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 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");
         }
     }
 }
Beispiel #4
0
 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();
 }
Beispiel #5
0
 static function Help()
 {
     Debugger::log("\n     Time Window operations\n     \n     tw:create [common opts]\n        Create window(s) for specified period and length\n\n     tw:delete [common opts]\n        Remove windows and dependent data from this range\n     \n     tw:empty [common opts]\n        Empty windows data but leave windows created\n        \n     tw:show\n        Show informations about timewindows in db\n        \n     tw:stats\n        Show statistics about timewindows in db\n    \n    tw:zstats\n        Show statistics about zabbix data at timewindows\n    \n    tw:modify\n        Modify or rename window(s)\n        \n     tw:loi\n        Recompute Level of Interest for windows\n     \n     Date formats: @timestamp, YYYYMMDDhhmm, now, '1 day ago', '00:00 1 day ago'\n     TimeWindow formats: Date_format/length, Date_format-Date_format/length, id\n     If no start and end date given, all data will be affected.\n     \n    [common opts]\n     \n", Debugger::ERROR);
     Options::help();
     exit;
 }