+
+ // Check if the priority is in a valid range
+ if (!in_array($pid["priority"], array(PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW, PRIORITY_NEGLIGIBLE)))
+ $pid["priority"] = PRIORITY_MEDIUM;
+
+ // Define the maximum durations
+ $max_duration_defaults = array(PRIORITY_CRITICAL => 360, PRIORITY_HIGH => 10, PRIORITY_MEDIUM => 60, PRIORITY_LOW => 180, PRIORITY_NEGLIGIBLE => 360);
+ $max_duration = $max_duration_defaults[$pid["priority"]];
+
+ $argv = json_decode($pid["parameter"]);
+ $argv[0] = basename($argv[0]);
+
+ // How long is the process already running?