fixing bug regarding the reset of the Connection, in some cases some cached objects have not been reset as intended

This commit is contained in:
Klaus Leithoff 2012-08-29 09:29:42 +00:00
parent 988d8148c5
commit 8e9a616e9f
4 changed files with 18 additions and 6 deletions

View File

@ -1067,7 +1067,7 @@ class ajaxfelamimail
);
$headerData = $headerData['header'][0];
//error_log(__METHOD__.__LINE__.print_r($headerData,true));
foreach ($headerData as $key => $val)
foreach ((array)$headerData as $key => $val)
{
if (is_array($val))
{

View File

@ -277,7 +277,11 @@ class felamimail_activesync implements activesync_plugin_write, activesync_plugi
//error_log(__METHOD__.__LINE__.' create object with ProfileID:'.array2string(self::$profileID));
if (!$this->mail->openConnection(self::$profileID,false))
{
error_log(__METHOD__.__LINE__."($account) can not open connection!".$this->mail->getErrorMessage());
error_log(date('Y-m-d H:i:s').' '.__METHOD__.__LINE__."($account) can not open connection!".$this->mail->getErrorMessage()."\n",3,'/var/lib/egroupware/esync-imap.log');
error_log('# Instance='.$GLOBALS['egw_info']['user']['domain'].', User='.$GLOBALS['egw_info']['user']['account_lid'].', URL='.
($_SERVER['HTTPS']?'https://':'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n\n",3,'/var/lib/egroupware/esync-imap.log');
header("HTTP/1.1 500 Internal Server Error");
//die('Mail not or mis-configured!');
throw new egw_exception_not_found(__METHOD__."($account) can not open connection!");
}
}
@ -288,7 +292,11 @@ class felamimail_activesync implements activesync_plugin_write, activesync_plugi
{
if (!$this->mail->openConnection(self::$profileID,false))
{
error_log(__METHOD__.__LINE__."($account) can not open connection!".$this->mail->getErrorMessage());
error_log(date('Y-m-d H:i:s').' '.__METHOD__.__LINE__."($account) can not open connection!".$this->mail->getErrorMessage()."\n",3,'/var/lib/egroupware/esync-imap.log');
error_log('# Instance='.$GLOBALS['egw_info']['user']['domain'].', User='.$GLOBALS['egw_info']['user']['account_lid'].', URL='.
($_SERVER['HTTPS']?'https://':'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\n\n",3,'/var/lib/egroupware/esync-imap.log');
header("HTTP/1.1 500 Internal Server Error");
//die('Mail not or mis-configured!');
throw new egw_exception_not_found(__METHOD__."($account) can not open connection!");
}
}

View File

@ -1165,7 +1165,7 @@ class felamimail_bo
{
static $structure;
if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
//error_log(__METHOD__.__LINE__." UID: $_uid, ".$this->icServer->ImapServerId.','.$_folder);
//error_log(__METHOD__.__LINE__.'User:'.trim($GLOBALS['egw_info']['user']['account_id'])." UID: $_uid, ".$this->icServer->ImapServerId.','.$_folder);
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*1);
if (isset($structure[$this->icServer->ImapServerId]) && !empty($structure[$this->icServer->ImapServerId]) &&
isset($structure[$this->icServer->ImapServerId][$_folder]) && !empty($structure[$this->icServer->ImapServerId][$_folder]) &&

View File

@ -181,13 +181,17 @@ class uifelamimail
if (isset($GLOBALS['egw_info']['user']['preferences']['felamimail']['ActiveProfileID']))
self::$icServerID = (int)$GLOBALS['egw_info']['user']['preferences']['felamimail']['ActiveProfileID'];
//_debug_array(self::$icServerID);
if (is_object($preferences)) $imapServer = $preferences->getIncomingServer(self::$icServerID);
if (isset($imapServer->ImapServerId) && !empty($imapServer->ImapServerId))
{
self::$icServerID = $GLOBALS['egw_info']['user']['preferences']['felamimail']['ActiveProfileID'] = $imapServer->ImapServerId;
}
echo "<h2>".lang('Test Connection and display basic information about the selected profile')."</h2>";
_debug_array('Connection Reset triggered:'.$connectionReset.' for Profile with ID:'.self::$icServerID);
emailadmin_bo::unsetCachedObjects(self::$icServerID);
if ($preferences->preferences['prefcontroltestconnection'] == 'reset') exit;
if (is_object($preferences)) $imapServer = $preferences->getIncomingServer(self::$icServerID);
echo "<hr /><h3 style='color:red'>".lang('IMAP Server')."</h3>";
if($imapServer->_connectionErrorObject) $eO = $imapServer->_connectionErrorObject;
unset($imapServer->_connectionErrorObject);
@ -209,7 +213,7 @@ class uifelamimail
}
else
{
_debug_array(array('ImapServerID' =>$imapServer->ImapServerId,
_debug_array(array('ImapServerId' =>$imapServer->ImapServerId,
'host'=>$imapServer->host,
'port'=>$imapServer->port,
'validatecert'=>$imapServer->validatecert));