$found = DBA::exists('workerqueue', ['command' => $command, 'parameter' => $parameters, 'done' => false]);
$added = 0;
- if (!in_array($priority, PRIORITIES)) {
+ if (!is_int($priority) || !in_array($priority, PRIORITIES)) {
Logger::warning('Invalid priority', ['priority' => $priority, 'command' => $command, 'callstack' => System::callstack(20)]);
$priority = PRIORITY_MEDIUM;
}
return GRAVITY_UNKNOWN; // Should not happen
}
- public static function insert(array $item, bool $notify = false, bool $post_local = true)
+ public static function insert(array $item, int $notify = 0, bool $post_local = true)
{
$orig_item = $item;
$item['protocol'] = Conversation::PARCEL_DIRECT;
$item['direction'] = Conversation::PUSH;
- if (in_array($notify, PRIORITIES)) {
+ if (is_int($notify) && in_array($notify, PRIORITIES)) {
$priority = $notify;
}
} else {