Bugfix for masses of php warnings
This commit is contained in:
parent
c74b7565a9
commit
dc439c6e50
|
@ -91,8 +91,6 @@ function poller_execute($queue) {
|
||||||
|
|
||||||
$mypid = getmypid();
|
$mypid = getmypid();
|
||||||
|
|
||||||
$cooldown = Config::get("system", "worker_cooldown", 0);
|
|
||||||
|
|
||||||
// Quit when in maintenance
|
// Quit when in maintenance
|
||||||
if (Config::get('system', 'maintenance', true)) {
|
if (Config::get('system', 'maintenance', true)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -138,8 +136,6 @@ function poller_execute($queue) {
|
||||||
|
|
||||||
$argv = json_decode($queue["parameter"]);
|
$argv = json_decode($queue["parameter"]);
|
||||||
|
|
||||||
$argc = count($argv);
|
|
||||||
|
|
||||||
// Check for existance and validity of the include file
|
// Check for existance and validity of the include file
|
||||||
$include = $argv[0];
|
$include = $argv[0];
|
||||||
|
|
||||||
|
@ -155,6 +151,30 @@ function poller_execute($queue) {
|
||||||
|
|
||||||
if (function_exists($funcname)) {
|
if (function_exists($funcname)) {
|
||||||
|
|
||||||
|
poller_exec_function($queue, $funcname, $argv);
|
||||||
|
|
||||||
|
q("DELETE FROM `workerqueue` WHERE `id` = %d", intval($queue["id"]));
|
||||||
|
} else {
|
||||||
|
logger("Function ".$funcname." does not exist");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Execute a function from the queue
|
||||||
|
*
|
||||||
|
* @param array $queue Workerqueue entry
|
||||||
|
* @param string $funcname name of the function
|
||||||
|
*/
|
||||||
|
function poller_exec_function($queue, $funcname, $argv) {
|
||||||
|
|
||||||
|
$a = get_app();
|
||||||
|
|
||||||
|
$mypid = getmypid();
|
||||||
|
|
||||||
|
$argc = count($argv);
|
||||||
|
|
||||||
logger("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." ".$queue["parameter"]);
|
logger("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." ".$queue["parameter"]);
|
||||||
|
|
||||||
$stamp = (float)microtime(true);
|
$stamp = (float)microtime(true);
|
||||||
|
@ -189,25 +209,30 @@ function poller_execute($queue) {
|
||||||
$duration = microtime(true)-$a->performance["start"];
|
$duration = microtime(true)-$a->performance["start"];
|
||||||
|
|
||||||
if (Config::get("rendertime", "callstack")) {
|
if (Config::get("rendertime", "callstack")) {
|
||||||
|
if (isset($a->callstack["database"])) {
|
||||||
$o = "\nDatabase Read:\n";
|
$o = "\nDatabase Read:\n";
|
||||||
foreach ($a->callstack["database"] AS $func => $time) {
|
foreach ($a->callstack["database"] AS $func => $time) {
|
||||||
$time = round($time, 3);
|
$time = round($time, 3);
|
||||||
if ($time > 0)
|
if ($time > 0)
|
||||||
$o .= $func.": ".$time."\n";
|
$o .= $func.": ".$time."\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (isset($a->callstack["database_write"])) {
|
||||||
$o .= "\nDatabase Write:\n";
|
$o .= "\nDatabase Write:\n";
|
||||||
foreach ($a->callstack["database_write"] AS $func => $time) {
|
foreach ($a->callstack["database_write"] AS $func => $time) {
|
||||||
$time = round($time, 3);
|
$time = round($time, 3);
|
||||||
if ($time > 0)
|
if ($time > 0)
|
||||||
$o .= $func.": ".$time."\n";
|
$o .= $func.": ".$time."\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (isset($a->callstack["network"])) {
|
||||||
$o .= "\nNetwork:\n";
|
$o .= "\nNetwork:\n";
|
||||||
foreach ($a->callstack["network"] AS $func => $time) {
|
foreach ($a->callstack["network"] AS $func => $time) {
|
||||||
$time = round($time, 3);
|
$time = round($time, 3);
|
||||||
if ($time > 0)
|
if ($time > 0)
|
||||||
$o .= $func.": ".$time."\n";
|
$o .= $func.": ".$time."\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$o = '';
|
$o = '';
|
||||||
}
|
}
|
||||||
|
@ -222,17 +247,12 @@ function poller_execute($queue) {
|
||||||
LOGGER_DEBUG);
|
LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cooldown = Config::get("system", "worker_cooldown", 0);
|
||||||
|
|
||||||
if ($cooldown > 0) {
|
if ($cooldown > 0) {
|
||||||
logger("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." - in cooldown for ".$cooldown." seconds");
|
logger("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." - in cooldown for ".$cooldown." seconds");
|
||||||
sleep($cooldown);
|
sleep($cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
q("DELETE FROM `workerqueue` WHERE `id` = %d", intval($queue["id"]));
|
|
||||||
} else {
|
|
||||||
logger("Function ".$funcname." does not exist");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user