mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-23 05:41:02 +01:00
introduce more caching to the fetch of userProfile Data; alter mergeProfileData to work as intended (failed to work as intended after change from some boolean/integer columns to yes/no: you may allow stuff, but you should not be able to remove an already granted right)
This commit is contained in:
parent
9ffa14dbb5
commit
e819436f15
@ -310,6 +310,12 @@ class emailadmin_bo extends so_sql
|
||||
//error_log("sessionData Restored for Profile $_profileID <br>");
|
||||
return self::$sessionData['profile'][$_profileID];
|
||||
}
|
||||
$EAuserProfileData= egw_cache::getCache(egw_cache::INSTANCE,'email','EAuserProfileData'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*1);
|
||||
if (isset($EAuserProfileData[$_profileID]) && is_array($EAuserProfileData[$_profileID]) && !empty($EAuserProfileData[$_profileID]))
|
||||
{
|
||||
return $EAuserProfileData[$_profileID];
|
||||
}
|
||||
|
||||
$profileData = $this->soemailadmin->getProfileList($_profileID);
|
||||
$found = false;
|
||||
if (is_array($profileData) && count($profileData))
|
||||
@ -381,7 +387,8 @@ class emailadmin_bo extends so_sql
|
||||
{
|
||||
$profileData['ea_stationery_active_templates'] = explode(',',$profileData['ea_stationery_active_templates']);
|
||||
}
|
||||
self::$sessionData['profile'][$_profileID] = $profileData;
|
||||
self::$sessionData['profile'][$_profileID] = $EAuserProfileData[$_profileID] = $profileData;
|
||||
egw_cache::setCache(egw_cache::INSTANCE,'email','EAuserProfileData'.trim($GLOBALS['egw_info']['user']['account_id']),$EAuserProfileData, $expiration=60*1);
|
||||
$this->saveSessionData();
|
||||
return $profileData;
|
||||
}
|
||||
@ -497,6 +504,15 @@ class emailadmin_bo extends so_sql
|
||||
unset($eMailListContainsDeletedMessages[$_profileID]);
|
||||
egw_cache::setCache(egw_cache::INSTANCE,'email','eMailListContainsDeletedMessages'.trim($GLOBALS['egw_info']['user']['account_id']),$eMailListContainsDeletedMessages, $expiration=60*60*1);
|
||||
}
|
||||
//resetSessionCache['ea_preferences'], and cache to reduce database traffic
|
||||
unset(self::$sessionData['ea_preferences']);
|
||||
egw_cache::setCache(egw_cache::INSTANCE,'email','EASessionEAPrefs'.trim($GLOBALS['egw_info']['user']['account_id']),array(), $expiration=60*1);
|
||||
$EAuserProfileData= egw_cache::getCache(egw_cache::INSTANCE,'email','EAuserProfileData'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*1);
|
||||
if (isset($EAuserProfileData[$_profileID]))
|
||||
{
|
||||
unset($EAuserProfileData[$_profileID]);
|
||||
}
|
||||
egw_cache::setCache(egw_cache::INSTANCE,'email','EAuserProfileData'.trim($GLOBALS['egw_info']['user']['account_id']),$EAuserProfileData, $expiration=60*1);
|
||||
|
||||
$nameSpace = egw_cache::getSession('email','defaultimap_nameSpace');
|
||||
if (isset($nameSpace[$_profileID]))
|
||||
@ -518,6 +534,7 @@ class emailadmin_bo extends so_sql
|
||||
*/
|
||||
function getUserProfile($_appName='', $_groups='', $_profileID='')
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__." $_appName, $_groups, $_profileID".function_backtrace());
|
||||
if (!(is_array(self::$sessionData) && (count(self::$sessionData)>0))) $this->restoreSessionData();
|
||||
if (is_array(self::$sessionData) && count(self::$sessionData)>0 && self::$sessionData['ea_preferences'] &&
|
||||
($_profileID=='' && count(self::$sessionData['ea_preferences']->icServer) || $_profileID && isset(self::$sessionData['ea_preferences']->icServer[$_profileID])))
|
||||
@ -525,6 +542,12 @@ class emailadmin_bo extends so_sql
|
||||
//error_log("sessionData Restored for UserProfile<br>".array2string(self::$sessionData['ea_preferences']));
|
||||
return self::$sessionData['ea_preferences'];
|
||||
}
|
||||
if (empty($_profileID))
|
||||
{
|
||||
$EAPrefCache = egw_cache::getCache(egw_cache::INSTANCE,'email','EASessionEAPrefs'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*1);
|
||||
//error_log(__METHOD__.__LINE__.array2string($EAPrefCache));
|
||||
if (!empty($EAPrefCache) && $EAPrefCache instanceof ea_preferences) return $EAPrefCache;
|
||||
}
|
||||
$appName = ($_appName != '' ? $_appName : $GLOBALS['egw_info']['flags']['currentapp']);
|
||||
if(!is_array($_groups)) {
|
||||
// initialize with 0 => means no group id
|
||||
@ -582,6 +605,13 @@ class emailadmin_bo extends so_sql
|
||||
$icServer->enableCyrusAdmin = ($data['imapEnableCyrusAdmin'] == 'yes');
|
||||
$icServer->adminUsername = $data['imapAdminUsername'];
|
||||
$icServer->adminPassword = $data['imapAdminPW'];
|
||||
if ( $data['imapEnableCyrusAdmin'] == 'yes' &&
|
||||
isset($GLOBALS['egw_info']['server']['cyrus_admin_user']) && isset($GLOBALS['egw_info']['server']['cyrus_admin_password']) &&
|
||||
!empty($GLOBALS['egw_info']['server']['cyrus_admin_user']) && !empty($GLOBALS['egw_info']['server']['cyrus_admin_password']) )
|
||||
{
|
||||
$icServer->adminUsername = $GLOBALS['egw_info']['server']['cyrus_admin_user'];
|
||||
$icServer->adminPassword = $GLOBALS['egw_info']['server']['cyrus_admin_password'];
|
||||
}
|
||||
$icServer->enableSieve = ($data['imapEnableSieve'] == 'yes');
|
||||
if (!empty($data['imapSieveServer']))
|
||||
{
|
||||
@ -669,6 +699,7 @@ class emailadmin_bo extends so_sql
|
||||
$eaPreferences->ea_stationery_active_templates = explode(',',$data['ea_stationery_active_templates']);
|
||||
}
|
||||
self::$sessionData['ea_preferences'] = $eaPreferences;
|
||||
if (empty($_profileID)) egw_cache::setCache(egw_cache::INSTANCE,'email','EASessionEAPrefs'.trim($GLOBALS['egw_info']['user']['account_id']),$eaPreferences, $expiration=60*1);
|
||||
$this->saveSessionData();
|
||||
return $eaPreferences;
|
||||
}
|
||||
|
@ -230,7 +230,7 @@
|
||||
} else {
|
||||
if (array_key_exists($key, $toMerge) && !empty($toMerge[$key]))
|
||||
{
|
||||
#error_log($key.'->'.$toMerge[$key]);
|
||||
//error_log($key.'->'.$toMerge[$key]);
|
||||
switch ($key) {
|
||||
case 'imapLoginType':
|
||||
// if the logintype is admin, it will be added to the default value
|
||||
@ -249,7 +249,10 @@
|
||||
case 'imapEnableCyrusAdmin':
|
||||
case 'imapAdminUsername':
|
||||
case 'imapAdminPW':
|
||||
if (strlen($toMerge['imapServer'])>0) $mergeInTo[$key]=$toMerge[$key];
|
||||
if (strlen($toMerge['imapServer'])>0 && $toMerge[$key]!='no')
|
||||
{
|
||||
$mergeInTo[$key]=$toMerge[$key];
|
||||
}
|
||||
break;
|
||||
case 'smtpPort':
|
||||
case 'smtpType':
|
||||
@ -270,7 +273,9 @@
|
||||
if (strlen($testVal)>10 || $testVal != '<br>' || $testVal != '<br />') $mergeInTo[$key]=$toMerge[$key];
|
||||
break;
|
||||
default:
|
||||
$mergeInTo[$key]=$toMerge[$key];
|
||||
//you may allow stuff, but you should not be able to remove an already granted right
|
||||
//error_log($key.'->'.$toMerge[$key].' '.function_backtrace());
|
||||
if ($toMerge[$key]!='no') $mergeInTo[$key]=$toMerge[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user