if session is already closed, reopen it for push-notification, as we need to store if a push message is already delivered

This commit is contained in:
Ralf Becker 2020-04-02 11:16:55 +02:00
parent 6664aea901
commit f9a961085f

View File

@ -39,6 +39,10 @@ class notifications_push implements Json\PushBackend
public static function get()
{
if (session_status() === PHP_SESSION_NONE)
{
$session_reopened = session_start();
}
$already_send =& Api\Cache::getSession(__CLASS__, 'already_send');
$max_id = Api\Cache::getInstance(__CLASS__, 'max_id');
@ -72,6 +76,10 @@ class notifications_push implements Json\PushBackend
$already_send = $row['notify_id'];
}
}
if (!empty($session_reopened))
{
session_write_close();
}
//error_log(__METHOD__."() max_id=$max_id, already_sent=$already_send");
}