+ if (!Config::get("system", "frontend_worker") OR !Config::get("system", "worker")) {
+ return;
+ }
+
+ // Do we have "proc_open"? Then we can fork the poller
+ if (function_exists("proc_open")) {
+ // When was the last time that we called the worker?
+ // Less than one minute? Then we quit
+ if ((time() - get_config("system", "worker_started")) < 60) {
+ return;
+ }
+
+ set_config("system", "worker_started", time());
+
+ // Do we have enough running workers? Then we quit here.
+ if (poller_too_much_workers()) {
+ // Cleaning dead processes
+ poller_kill_stale_workers();
+ get_app()->remove_inactive_processes();
+
+ return;
+ }
+
+ poller_run_cron();
+
+ logger('Call poller', LOGGER_DEBUG);
+
+ $args = array("php", "include/poller.php", "no_cron");
+ $a = get_app();
+ $a->proc_run($args);