From 57c361fd3f15c7e6ef957f69f97bdbff99ae975f Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Mon, 2 Jul 2012 11:16:29 +0000 Subject: [PATCH] reset connectionError Cache on login --- emailadmin/inc/class.emailadmin_bo.inc.php | 14 +-------- felamimail/inc/class.felamimail_bo.inc.php | 33 ++++++++++++++++++++++ felamimail/inc/class.uifelamimail.inc.php | 1 + felamimail/setup/setup.inc.php | 1 + 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/emailadmin/inc/class.emailadmin_bo.inc.php b/emailadmin/inc/class.emailadmin_bo.inc.php index 773f12f2d7..754df4d861 100644 --- a/emailadmin/inc/class.emailadmin_bo.inc.php +++ b/emailadmin/inc/class.emailadmin_bo.inc.php @@ -582,19 +582,7 @@ class emailadmin_bo extends so_sql { if (!is_array($_profileID) && is_numeric($_profileID)) { - //error_log(__METHOD__.__LINE__.' for Profile:'.$_profileID); - $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::setCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$buff,$expiration=60*15); - } - $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::setCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isConError,$expiration=60*15); - } + felamimail_bo::resetConnectionErrorCache($_profileID); $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[$_profileID])) { diff --git a/felamimail/inc/class.felamimail_bo.inc.php b/felamimail/inc/class.felamimail_bo.inc.php index 7d40da7dc2..f824f3fb75 100644 --- a/felamimail/inc/class.felamimail_bo.inc.php +++ b/felamimail/inc/class.felamimail_bo.inc.php @@ -1609,6 +1609,39 @@ class felamimail_bo return $retValue; } + static function resetConnectionErrorCache($_ImapServerId=null) + { + //error_log(__METHOD__.__LINE__.' for Profile:'.array2string($_ImapServerId) .' for user:'.trim($GLOBALS['egw_info']['user']['account_id'])); + $account_id = $GLOBALS['egw_info']['user']['account_id']; + if (is_array($_ImapServerId)) + { + // called via hook + $account_id = $_ImapServerId['account_id']; + unset($_ImapServerId); + $_ImapServerId = null; + } + if (is_null($_ImapServerId)) + { + $buff = array(); + $isConError = array(); + } + else + { + $buff = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($account_id)); + if (isset($buff[$_ImapServerId])) + { + unset($buff[$_ImapServerId]); + } + $isConError = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($account_id)); + if (isset($isConError[$_ImapServerId])) + { + unset($isConError[$_ImapServerId]); + } + } + egw_cache::setCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($account_id),$buff,$expiration=60*15); + egw_cache::setCache(egw_cache::INSTANCE,'email','icServerSIEVE_connectionError'.trim($account_id),$isConError,$expiration=60*15); + } + static function resetFolderObjectCache($_ImapServerId=null) { //error_log(__METHOD__.__LINE__.' called for Profile:'.$_ImapServerId.'->'.function_backtrace()); diff --git a/felamimail/inc/class.uifelamimail.inc.php b/felamimail/inc/class.uifelamimail.inc.php index 0bf683f360..c481e4e2d1 100644 --- a/felamimail/inc/class.uifelamimail.inc.php +++ b/felamimail/inc/class.uifelamimail.inc.php @@ -783,6 +783,7 @@ class uifelamimail function viewMainScreen() { + if (!$GLOBALS['egw']->hooks->hook_exists('session_creation','felamimail')) $GLOBALS['egw']->hooks->register_single_app_hook('felamimail','session_creation'); $connectionReset = false; // get passed messages if (!empty($_GET["msg"])) $message[] = html::purify($_GET["msg"]); diff --git a/felamimail/setup/setup.inc.php b/felamimail/setup/setup.inc.php index 7e24b426f8..e30afa19ce 100644 --- a/felamimail/setup/setup.inc.php +++ b/felamimail/setup/setup.inc.php @@ -35,6 +35,7 @@ $setup_info['felamimail']['hooks']['editaccount'] = 'felamimail_hooks::accountHo $setup_info['felamimail']['hooks']['verify_settings'] = 'felamimail_bo::forcePrefReload'; $setup_info['felamimail']['hooks']['edit_user'] = 'felamimail_hooks::adminMenu'; $setup_info['felamimail']['hooks']['search_link'] = 'felamimail_hooks::search_link'; +$setup_info['felamimail']['hooks']['session_creation'] = 'felamimail_bo::resetConnectionErrorCache'; /* Dependencies for this app to work */ $setup_info['felamimail']['depends'][] = array(