* eMail: improve connection handling and recovery on problems regarded as minor. offer user the possibility to reset the connection on failure

This commit is contained in:
Klaus Leithoff 2011-10-07 10:27:09 +00:00
parent f40634fe6a
commit 2b2de0cd8b
5 changed files with 29 additions and 6 deletions

View File

@ -509,7 +509,7 @@ class defaultimap extends Net_IMAP
function openConnection($_adminConnection=false, $_timeout=20)
{
//error_log(__METHOD__.function_backtrace());
//error_log(__METHOD__.__LINE__.($_adminConnection?' Adminconnection':'').array2string($this));
//error_log(__METHOD__.__LINE__.($_adminConnection?' Adminconnection':' ').array2string($this));
unset($this->_connectionErrorObject);
if($_adminConnection) {

View File

@ -3390,9 +3390,17 @@ class felamimail_bo
if (is_null($isError)) $isError =& egw_cache::getSession('email','icServerIMAP_connectionError');
if ( isset($isError[$_icServerID]) || PEAR::isError($this->icServer->_connectionErrorObject))
{
//error_log(__METHOD__.__LINE__.' failed for Reason:'.$isError[$_icServerID]);
$this->errorMessage = ($isError[$_icServerID]?$isError[$_icServerID]:$this->icServer->_connectionErrorObject->message);
return false;
if (trim($isError[$_icServerID])==',')
{
//error_log(__METHOD__.__LINE__.' Connection seemed to have failed in the past, no real reason given, try to recover on our own.');
emailadmin_bo::unsetCachedObjects($_icServerID);
}
else
{
//error_log(__METHOD__.__LINE__.' failed for Reason:'.$isError[$_icServerID]);
$this->errorMessage = ($isError[$_icServerID]?$isError[$_icServerID]:$this->icServer->_connectionErrorObject->message);
return false;
}
}
if (!is_object($this->mailPreferences))
{
@ -3432,7 +3440,7 @@ class felamimail_bo
$isError[$_icServerID] = ($tretval?$tretval->message:$this->icServer->_connectionErrorObject->message);
if (self::$debug)
{
error_log(__METHOD__.__LINE__." # failed to open new Connection ProfileID:".$_icServerID.' Status:'.print_r($this->icServer->_connected,true).' Message:'.$this->icServer->_connectionErrorObject->message.' called from '.function_backtrace());
error_log(__METHOD__.__LINE__." # failed to open new Connection ProfileID:".$_icServerID.' Status:'.print_r($this->icServer->_connected,true).' Message:'.$isError[$_icServerID].' called from '.function_backtrace());
error_log(__METHOD__.__LINE__.' # Instance='.$GLOBALS['egw_info']['user']['domain'].', User='.$GLOBALS['egw_info']['user']['account_lid']);
}
}

View File

@ -626,11 +626,16 @@ class uifelamimail
function viewMainScreen()
{
$connectionReset = false;
// get passed messages
if (!empty($_GET["msg"])) $message[] = html::purify($_GET["msg"]);
if (!empty($_GET["message"])) $message[] = html::purify($_GET["message"]);
if (!empty($_GET["resetConnection"])) $connectionReset = html::purify($_GET["resetConnection"]);
unset($_GET["msg"]);
unset($_GET["message"]);
unset($_GET["resetConnection"]);
//error_log(__METHOD__.__LINE__.$connectionReset);
#printf ("this->uifelamimail->viewMainScreen() start: %s<br>",date("H:i:s",mktime()));
$bofilter =& $this->bofilter;
$uiwidgets = CreateObject('felamimail.uiwidgets');
@ -641,6 +646,11 @@ 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 ($connectionReset)
{
error_log(__METHOD__.__LINE__.' Connection Reset triggered:'.$connectionReset.' for Profile with ID:'.self::$icServerID);
emailadmin_bo::unsetCachedObjects(self::$icServerID);
}
if (is_object($preferences)) $imapServer = $preferences->getIncomingServer(self::$icServerID);
//_debug_array($imapServer);
//_debug_array($preferences->preferences);
@ -912,7 +922,10 @@ class uifelamimail
$this->t->set_var('select_status', $selectStatus);
if($this->connectionStatus === false) {
$this->t->set_var('connection_error_message', lang($this->bofelamimail->getErrorMessage()));
$linkData = array('menuaction' => 'felamimail.uifelamimail.viewMainScreen','resetConnection'=>true);
$this->t->set_var('connection_error_message', lang($this->bofelamimail->getErrorMessage()).
'<br/><a href="'.egw::link('/index.php',$linkData).'">'.
lang('You may try to reset the connection using this link.').'</a>');
$this->t->set_var('message', '&nbsp;');
$this->t->parse('header_rows','error_message',True);
} else {

View File

@ -535,4 +535,5 @@ yes, offer copy option felamimail de ja, mit Kopieroption
you can either choose to save as infolog or tracker, not both. felamimail de Sie können eine Mail entweder als Infolog ODER als Verfolgungsqueue Eintrag speichern, nicht als beides gleichzeitig.
you can use %1 for the above start-date and %2 for the end-date. felamimail de Sie können %1 für das obige Startdatum und %2 für das Endedatum verwenden.
you have received a new message on the felamimail de Sie haben eine neue Nachricht erhalten:
you may try to reset the connection using this link. felamimail de Sie können versuchen die Verbindung wiederherzustellen, indem Sie auf diesen Link klicken.
your message to %1 was displayed. felamimail de Ihre Nachricht an %1 wurde angezeigt.

View File

@ -546,4 +546,5 @@ yes, offer copy option felamimail en Yes, offer copy option
you can either choose to save as infolog or tracker, not both. felamimail en You can either choose to save as InfoLog OR Tracker, not both.
you can use %1 for the above start-date and %2 for the end-date. felamimail en You can use %1 for the above start date and %2 for the end date.
you have received a new message on the felamimail en You have received a new message on the
you may try to reset the connection using this link. felamimail en You may try to reset the connection using this link.
your message to %1 was displayed. felamimail en Your message to %1 was displayed.