use egw_cache for session read/write; fix cache handling for flagMessages

This commit is contained in:
Klaus Leithoff 2013-10-04 09:26:20 +00:00
parent efb5ef4671
commit dda8edf295
2 changed files with 10 additions and 10 deletions

View File

@ -68,8 +68,8 @@ class ajaxfelamimail
$folderToSelect = null; $folderToSelect = null;
} }
$this->sessionDataAjax =& $GLOBALS['egw']->session->appsession('ajax_session_data','felamimail'); $this->sessionDataAjax = egw_cache::getCache(egw_cache::SESSION,'felamimail','ajax_session_data',$callback=null,$callback_params=array(),$expiration=60*60*1);
$this->sessionData =& $GLOBALS['egw']->session->appsession('session_data','felamimail'); $this->sessionData = egw_cache::getCache(egw_cache::SESSION,'felamimail','session_data',$callback=null,$callback_params=array(),$expiration=60*60*1);
$this->sessionData['folderStatus'] = egw_cache::getCache(egw_cache::INSTANCE,'email','folderStatus'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*1); $this->sessionData['folderStatus'] = egw_cache::getCache(egw_cache::INSTANCE,'email','folderStatus'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*1);
if (!is_array($this->sessionDataAjax)) $this->sessionDataAjax = array(); if (!is_array($this->sessionDataAjax)) $this->sessionDataAjax = array();
if (!isset($this->sessionData['mailbox'])) $this->sessionData['mailbox'] = (isset($folderToSelect)?$folderToSelect:(isset($this->sessionDataAjax['folderName'])?$this->sessionDataAjax['folderName']:'INBOX')); if (!isset($this->sessionData['mailbox'])) $this->sessionData['mailbox'] = (isset($folderToSelect)?$folderToSelect:(isset($this->sessionDataAjax['folderName'])?$this->sessionDataAjax['folderName']:'INBOX'));
@ -1449,13 +1449,13 @@ class ajaxfelamimail
function saveSessionData() function saveSessionData()
{ {
$GLOBALS['egw']->session->appsession('ajax_session_data','felamimail',$this->sessionDataAjax); egw_cache::setCache(egw_cache::SESSION,'felamimail','ajax_session_data',$this->sessionDataAjax, $expiration=60*60*1);
if (isset($this->sessionData['folderStatus']) && is_array($this->sessionData['folderStatus'])) if (isset($this->sessionData['folderStatus']) && is_array($this->sessionData['folderStatus']))
{ {
egw_cache::setCache(egw_cache::INSTANCE,'email','folderStatus'.trim($GLOBALS['egw_info']['user']['account_id']),$this->sessionData['folderStatus'], $expiration=60*60*1); egw_cache::setCache(egw_cache::INSTANCE,'email','folderStatus'.trim($GLOBALS['egw_info']['user']['account_id']),$this->sessionData['folderStatus'], $expiration=60*60*1);
unset($this->sessionData['folderStatus']); unset($this->sessionData['folderStatus']);
} }
$GLOBALS['egw']->session->appsession('session_data','felamimail',$this->sessionData); egw_cache::setCache(egw_cache::SESSION,'felamimail','session_data',$this->sessionData, $expiration=60*60*1);
} }
function saveSignature($_mode, $_id, $_description, $_signature, $_isDefaultSignature) function saveSignature($_mode, $_id, $_description, $_signature, $_isDefaultSignature)

View File

@ -1310,10 +1310,10 @@ class felamimail_bo
$cachemodified = false; $cachemodified = false;
foreach ((array)$_messageUID as $k => $_uid) foreach ((array)$_messageUID as $k => $_uid)
{ {
if (isset($summary[$this->icServer->ImapServerId][(!empty($currentFolder)?$currentFolder: $this->sessionData['mailbox'])][$_uid])) if (isset($summary[$this->icServer->ImapServerId][(!empty($_folder)?$_folder: $this->sessionData['mailbox'])][$_uid]))
{ {
$cachemodified = true; $cachemodified = true;
unset($summary[$this->icServer->ImapServerId][(!empty($currentFolder)?$currentFolder: $this->sessionData['mailbox'])][$_uid]); unset($summary[$this->icServer->ImapServerId][(!empty($_folder)?$_folder: $this->sessionData['mailbox'])][$_uid]);
} }
} }
if ($cachemodified) if ($cachemodified)
@ -1321,7 +1321,7 @@ class felamimail_bo
egw_cache::setCache(egw_cache::INSTANCE,'email','summaryCache'.trim($GLOBALS['egw_info']['user']['account_id']),$summary,$expiration=60*60*1); egw_cache::setCache(egw_cache::INSTANCE,'email','summaryCache'.trim($GLOBALS['egw_info']['user']['account_id']),$summary,$expiration=60*60*1);
} }
$this->sessionData['folderStatus'][$this->profileID][$this->sessionData['mailbox']]['uidValidity'] = 0; $this->sessionData['folderStatus'][$this->profileID][(!empty($_folder)?$_folder: $this->sessionData['mailbox'])]['uidValidity'] = 0;
$this->saveSessionData(); $this->saveSessionData();
//error_log(__METHOD__.__LINE__.'->' .$_flag." ".array2string($_messageUID).",".($_folder?$_folder:$this->sessionData['mailbox'])); //error_log(__METHOD__.__LINE__.'->' .$_flag." ".array2string($_messageUID).",".($_folder?$_folder:$this->sessionData['mailbox']));
return true; // as we do not catch/examine setFlags returnValue return true; // as we do not catch/examine setFlags returnValue
@ -3125,7 +3125,7 @@ class felamimail_bo
$queryString = implode(',', $sortResult); $queryString = implode(',', $sortResult);
// fetch the data for the selected messages // fetch the data for the selected messages
if (self::$debug) $starttime = microtime(true); if (self::$debug) $starttime = microtime(true);
//$headersNew = $this->_getSummary($queryString, $rByUid); //$headersNew = $this->_getSummary($queryString, $rByUidi,false,$_folderName);
$headersNew = $this->icServer->getSummary($queryString, $rByUid); $headersNew = $this->icServer->getSummary($queryString, $rByUid);
if (PEAR::isError($headersNew) && empty($queryString)) if (PEAR::isError($headersNew) && empty($queryString))
{ {
@ -4277,7 +4277,7 @@ class felamimail_bo
{ {
$GLOBALS['egw_info']['flags']['autoload'] = array(__CLASS__,'autoload'); $GLOBALS['egw_info']['flags']['autoload'] = array(__CLASS__,'autoload');
$this->sessionData = $GLOBALS['egw']->session->appsession('session_data','felamimail'); $this->sessionData = egw_cache::getCache(egw_cache::SESSION,'felamimail','session_data',$callback=null,$callback_params=array(),$expiration=60*60*1);
$this->sessionData['folderStatus'] = egw_cache::getCache(egw_cache::INSTANCE,'email','folderStatus'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*1); $this->sessionData['folderStatus'] = egw_cache::getCache(egw_cache::INSTANCE,'email','folderStatus'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*1);
} }
@ -4288,7 +4288,7 @@ class felamimail_bo
egw_cache::setCache(egw_cache::INSTANCE,'email','folderStatus'.trim($GLOBALS['egw_info']['user']['account_id']),$this->sessionData['folderStatus'], $expiration=60*60*1); egw_cache::setCache(egw_cache::INSTANCE,'email','folderStatus'.trim($GLOBALS['egw_info']['user']['account_id']),$this->sessionData['folderStatus'], $expiration=60*60*1);
unset($this->sessionData['folderStatus']); unset($this->sessionData['folderStatus']);
} }
$GLOBALS['egw']->session->appsession('session_data','felamimail',$this->sessionData); egw_cache::setCache(egw_cache::SESSION,'felamimail','session_data',$this->sessionData, $expiration=60*60*1);
} }
function saveFilter($_formData) function saveFilter($_formData)