mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 00:29:38 +01:00
* ESync: fix a problem with a non working global profile, when verifying settings
This commit is contained in:
parent
e694fa2029
commit
05f8a151b8
@ -248,7 +248,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
||||
$this->__construct($this->backend);
|
||||
|
||||
try {
|
||||
$this->_connect();
|
||||
$this->_connect(0,true);
|
||||
$this->_disconnect();
|
||||
|
||||
if (!$this->_wasteID) $errors[] = lang('No valid %1 folder configured!', '<b>'.lang('trash').'</b>');
|
||||
@ -270,9 +270,10 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
||||
* Open IMAP connection
|
||||
*
|
||||
* @param int $account integer id of account to use
|
||||
* @param boolean $verify_mode mode used for verify_settings; we want the exception but not the header stuff
|
||||
* @todo support different accounts
|
||||
*/
|
||||
private function _connect($account=0)
|
||||
private function _connect($account=0, $verify_mode=false)
|
||||
{
|
||||
static $waitOnFailure;
|
||||
if ($this->mail && $this->account != $account) $this->_disconnect();
|
||||
@ -283,7 +284,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
||||
|
||||
$connectionFailed = false;
|
||||
|
||||
if (is_null($waitOnFailure)||empty($waitOnFailure[self::$profileID])||empty($waitOnFailure[self::$profileID][$this->backend->_devid])) $waitOnFailure = egw_cache::getCache(egw_cache::INSTANCE,'email','ActiveSyncWaitOnFailure'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*2);
|
||||
if ($verify_mode==false && (is_null($waitOnFailure)||empty($waitOnFailure[self::$profileID])||empty($waitOnFailure[self::$profileID][$this->backend->_devid]))) $waitOnFailure = egw_cache::getCache(egw_cache::INSTANCE,'email','ActiveSyncWaitOnFailure'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*2);
|
||||
if (isset($waitOnFailure[self::$profileID]) && !empty($waitOnFailure[self::$profileID]) && !empty($waitOnFailure[self::$profileID][$this->backend->_devid]) && isset($waitOnFailure[self::$profileID][$this->backend->_devid]['lastattempt']) && !empty($waitOnFailure[self::$profileID][$this->backend->_devid]['lastattempt']) && isset($waitOnFailure[self::$profileID][$this->backend->_devid]['howlong']) && !empty($waitOnFailure[self::$profileID][$this->backend->_devid]['howlong']))
|
||||
{
|
||||
if ($waitOnFailure[self::$profileID][$this->backend->_devid]['lastattempt']+$waitOnFailure[self::$profileID][$this->backend->_devid]['howlong']<$hereandnow)
|
||||
@ -330,6 +331,14 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
||||
}
|
||||
if (empty($waitOnFailure[self::$profileID][$this->backend->_devid])) $waitOnFailure[self::$profileID][$this->backend->_devid] = array('howlong'=>$this->waitOnFailureDefault,'lastattempt'=>$hereandnow);
|
||||
if ($connectionFailed)
|
||||
{
|
||||
// in verify_moode, we want the exeption, but not the exit
|
||||
if ($verify_mode)
|
||||
{
|
||||
egw_cache::setCache(egw_cache::INSTANCE,'email','ActiveSyncWaitOnFailure'.trim($GLOBALS['egw_info']['user']['account_id']),$waitOnFailure,$expiration=60*60*2);
|
||||
throw new egw_exception_not_found(__METHOD__.__LINE__."($account) can not open connection on Profile #".self::$profileID."!".$this->mail->getErrorMessage().' for Instance='.$GLOBALS['egw_info']['user']['domain']);
|
||||
}
|
||||
else
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__."($account) could not open connection!".$errorMessage);
|
||||
//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');
|
||||
@ -353,6 +362,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
||||
_egw_log_exception($ethrown);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
//die('Mail not or mis-configured!');
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user