* email: fix for problems when trying to open attached messages twice; Solved by handling problems regarding the caching of message structures caused by problems with SessionHandler storing the structure-array

This commit is contained in:
Klaus Leithoff 2011-11-03 08:28:56 +00:00
parent ddb2190927
commit 320711dca4
3 changed files with 15 additions and 7 deletions

View File

@ -588,17 +588,17 @@ class emailadmin_bo extends so_sql
if (!is_array($_profileID) && is_numeric($_profileID))
{
//error_log(__METHOD__.__LINE__.' for Profile:'.$_profileID);
$buff = egw_cache::getSession('email','icServerIMAP_connectionError');
$buff = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']));
if (isset($buff[$_profileID]))
{
unset($buff[$_profileID]);
egw_cache::setSession('email','icServerIMAP_connectionError',$buff);
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$buff,$expiration=60*15);
}
$isConError = egw_cache::getSession('email','icServerSIEVE_connectionError');
$isConError = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']));
if (isset($isConError[$_profileID]))
{
unset($isConError[$_profileID]);
egw_cache::setSession('email','icServerSIEVE_connectionError');
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isConError,$expiration=60*15);
}
$nameSpace = egw_cache::getSession('email','defaultimap_nameSpace');
if (isset($nameSpace[$_profileID]))

View File

@ -68,7 +68,7 @@ class emailadmin_sieve extends Net_Sieve
function _connect($_icServer,$euser='')
{
static $isConError;
if (is_null($isConError)) $isConError =& egw_cache::getSession('email','icServerSIEVE_connectionError');
if (is_null($isConError)) $isConError =& egw_cache::getCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*15);
if ( isset($isConError[$_icServerID]) )
{
error_log(__METHOD__.__LINE__.' failed for Reason:'.$isConError[$_icServerID]);
@ -98,18 +98,21 @@ class emailadmin_sieve extends Net_Sieve
}
$this->icServer = $_icServer;
} else {
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isConError,$expiration=60*15);
return 'die';
}
if(PEAR::isError($this->error = $this->connect($sieveHost , $sievePort, null, $useTLS) ) ){
if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.": error in connect($sieveHost,$sievePort): ".$this->error->getMessage());
$isConError[$_icServerID] = "SIEVE: error in connect($sieveHost,$sievePort): ".$this->error->getMessage();
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isConError,$expiration=60*15);
return false;
}
if(PEAR::isError($this->error = $this->login($username, $password, null, $euser) ) ){
if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.array2string($this->icServer));
if ($this->debug) error_log(__CLASS__.'::'.__METHOD__.": error in login($username,$password,null,$euser): ".$this->error->getMessage());
$isConError[$_icServerID] = "SIEVE: error in login($username,$password,null,$euser): ".$this->error->getMessage();
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isConError,$expiration=60*15);
return false;
}
return true;

View File

@ -1052,13 +1052,14 @@ class felamimail_bo
{
static $structure;
$_folder = $this->sessionData['mailbox'];
if (is_null($structure)) $structure =& egw_cache::getSession('felamimail','structureCache');
if (is_null($structure)) $structure = egw_cache::getCache(egw_cache::INSTANCE,'email','structureCache'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*10);
if (isset($structure[$this->icServer->ImapServerId][$_folder][$_uid]))
{
//error_log(__METHOD__.__LINE__.' Using cache for structure on Server:'.$this->icServer->ImapServerId.' for uid:'.$_uid);
return $structure[$this->icServer->ImapServerId][$_folder][$_uid];
}
$structure[$this->icServer->ImapServerId][$_folder][$_uid] = $this->icServer->getStructure($_uid, $byUid);
egw_cache::setCache(egw_cache::INSTANCE,'email','structureCache'.trim($GLOBALS['egw_info']['user']['account_id']),$structure,$expiration=60*60*10);
return $structure[$this->icServer->ImapServerId][$_folder][$_uid];
}
@ -3439,7 +3440,7 @@ class felamimail_bo
{
static $isError;
//error_log(__METHOD__.__LINE__.'->'.$_icServerID.' called from '.function_backtrace());
if (is_null($isError)) $isError =& egw_cache::getSession('email','icServerIMAP_connectionError');
if (is_null($isError)) $isError = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*5);
if ( isset($isError[$_icServerID]) || PEAR::isError($this->icServer->_connectionErrorObject))
{
if (trim($isError[$_icServerID])==',' || trim($this->icServer->_connectionErrorObject->message) == ',')
@ -3459,11 +3460,13 @@ class felamimail_bo
if (self::$debug) error_log(__METHOD__." No Object for MailPreferences found.". function_backtrace());
$this->errorMessage .= lang('No valid data to create MailProfile!!');
$isError[$_icServerID] = new PEAR_Error($this->errorMessage);
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isError,$expiration=60*15);
return false;
}
if(!$this->icServer = $this->mailPreferences->getIncomingServer((int)$_icServerID)) {
$this->errorMessage .= lang('No active IMAP server found!!');
$isError[$_icServerID] = $this->errorMessage;
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isError,$expiration=60*15);
return false;
}
//error_log(__METHOD__.__LINE__.'->'.array2string($this->icServer->ImapServerId));
@ -3476,6 +3479,7 @@ class felamimail_bo
}
$this->icServer->_connectionErrorObject->message .= $this->errorMessage .= $errormessage;
$isError[$_icServerID] = $this->errorMessage;
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isError,$expiration=60*15);
return false;
}
//error_log( "-------------------------->open connection ".function_backtrace());
@ -3497,6 +3501,7 @@ class felamimail_bo
}
}
}
if ( PEAR::isError($tretval) ) egw_cache::setCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isError,$expiration=60*15);
//error_log(print_r($this->icServer->_connected,true));
return $tretval;
}