mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
add check if only fallback push and skip full refresh (Framework::refresh_opener) for push and supporting apps
This commit is contained in:
parent
56dbbf406f
commit
b60a9ffff4
@ -56,6 +56,14 @@ abstract class Extra
|
||||
*/
|
||||
public static function refresh_opener($msg, $app, $id=null, $type=null, $targetapp=null, $replace=null, $with=null, $msg_type=null)
|
||||
{
|
||||
// if we have real push available and a regular single-entry refresh of a push supporting app, no need to refresh
|
||||
if (!Json\Push::onlyFallback() &&
|
||||
!empty($type) && !empty($id) && // $type === null --> full reload
|
||||
Link::get_registry($app, 'push_data') !== null)
|
||||
{
|
||||
self::$extra['message'] = [$msg, $msg_type];
|
||||
return;
|
||||
}
|
||||
//error_log(__METHOD__.'('.array2string(func_get_args()).')');
|
||||
self::$extra['refresh-opener'] = func_get_args();
|
||||
|
||||
|
@ -109,7 +109,7 @@ class Push extends Msg
|
||||
*
|
||||
* @throws Exception\NotOnline
|
||||
*/
|
||||
protected function checkSetBackend()
|
||||
protected static function checkSetBackend()
|
||||
{
|
||||
if (!isset(self::$backend))
|
||||
{
|
||||
@ -142,4 +142,20 @@ class Push extends Msg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if only fallback / no real push available
|
||||
*
|
||||
* @return bool true: fallback, false: real push
|
||||
*/
|
||||
public static function onlyFallback()
|
||||
{
|
||||
try {
|
||||
self::checkSetBackend();
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
return true;
|
||||
}
|
||||
return self::$backend instanceof \notifications_push;
|
||||
}
|
||||
}
|
||||
|
@ -88,8 +88,9 @@ class notifications_ajax {
|
||||
private $response;
|
||||
|
||||
/**
|
||||
* Do we have a real push server, or only a fallback
|
||||
*
|
||||
* @var type
|
||||
* @var bool
|
||||
*/
|
||||
private $isPushServer;
|
||||
|
||||
@ -108,12 +109,10 @@ class notifications_ajax {
|
||||
|
||||
$this->db = $GLOBALS['egw']->db;
|
||||
|
||||
if (empty(($isPushServer = Api\Cache::getCache(Api\Cache::INSTANCE, 'notifications', 'isPushServer'))))
|
||||
$this->isPushServer = Api\Cache::getInstance('notifications', 'isPushServer', function ()
|
||||
{
|
||||
$isPushServer = (!((New Api\Json\Push ()) instanceof notifications_push));
|
||||
Api\Cache::setCache(Api\Cache::INSTANCE, 'notifications','isPushServer', $isPushServer, 86400);
|
||||
}
|
||||
$this->isPushServer = $isPushServer;
|
||||
return !Api\Json\Push::onlyFallback();
|
||||
}, [], 900);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user