mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-22 21:30:54 +01:00
* All apps: run link notifications after processing and returning control to user to speed up saving of entries with links to (big) projects
This commit is contained in:
parent
dbb22b6f79
commit
9c9dc59df7
@ -393,7 +393,7 @@ class asyncservice
|
||||
{
|
||||
return False; // cant obtain semaphore
|
||||
}
|
||||
if ($jobs = $this->read())
|
||||
if (($jobs = $this->read()))
|
||||
{
|
||||
foreach($jobs as $id => $job)
|
||||
{
|
||||
@ -401,6 +401,8 @@ class asyncservice
|
||||
//
|
||||
if ($GLOBALS['egw_info']['user']['account_id'] != $job['account_id'])
|
||||
{
|
||||
// run notifications, before changing account_id of enviroment
|
||||
egw_link::run_notifies();
|
||||
// unset all objects in $GLOBALS, which are created and used by ExecMethod, as they can contain user-data
|
||||
foreach($GLOBALS as $name => $value)
|
||||
{
|
||||
@ -410,7 +412,7 @@ class asyncservice
|
||||
$lang = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
|
||||
unset($GLOBALS['egw_info']['user']);
|
||||
|
||||
if ($GLOBALS['egw']->session->account_id = $job['account_id'])
|
||||
if (($GLOBALS['egw']->session->account_id = $job['account_id']))
|
||||
{
|
||||
$GLOBALS['egw']->session->account_lid = $GLOBALS['egw']->accounts->id2name($job['account_id']);
|
||||
$GLOBALS['egw']->session->account_domain = $domain;
|
||||
|
@ -246,14 +246,18 @@ class egw_link extends solink
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by egw::egw_final to store the title-cache in the session
|
||||
* Called by egw::shutdown to store the title-cache in session and run notifications
|
||||
*
|
||||
* Would probably better called shutdown as well.
|
||||
*/
|
||||
static function save_session_cache()
|
||||
{
|
||||
//error_log(__METHOD__.'() items in title-cache: '.count(self::$title_cache).' file-access-cache: '.count(self::$file_access_cache));
|
||||
$GLOBALS['egw']->session->appsession('link_title_cache','phpgwapi',self::$title_cache);
|
||||
$GLOBALS['egw']->session->appsession('link_file_access_cache','phpgwapi',self::$file_access_cache);
|
||||
|
||||
// send out notifications about added, changed or removed links
|
||||
self::run_notifies();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1298,6 +1302,13 @@ class egw_link extends solink
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores notifications to run after regular processing is done
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $notifies = array();
|
||||
|
||||
/**
|
||||
* notify an application about a new or deleted links to own entries or updates in the content of the linked entry
|
||||
*
|
||||
@ -1316,17 +1327,33 @@ class egw_link extends solink
|
||||
//error_log(__METHOD__."('$type', '$notify_app', $notify_id, '$target_app', $target_id, $link_id, $data)");
|
||||
if ($link_id && isset(self::$app_register[$notify_app]) && isset(self::$app_register[$notify_app]['notify']))
|
||||
{
|
||||
ExecMethod(self::$app_register[$notify_app]['notify'],array(
|
||||
self::$notifies[] = array(
|
||||
'method' => self::$app_register[$notify_app]['notify'],
|
||||
'type' => $type,
|
||||
'id' => $notify_id,
|
||||
'target_app' => $target_app,
|
||||
'target_id' => $target_id,
|
||||
'link_id' => $link_id,
|
||||
'data' => $data,
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run notifications called by egw_link::save_session_cache from egw::shutdown, after regular processing is finished
|
||||
*/
|
||||
static public function run_notifies()
|
||||
{
|
||||
foreach(self::$notifies as $args)
|
||||
{
|
||||
$method = $args['method'];
|
||||
unset($args['method']);
|
||||
//error_log(__METHOD__."() calling $method(".array2string($args).')');
|
||||
ExecMethod($method, $args);
|
||||
}
|
||||
self::$notifies = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* notifies about unlinked links
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user