reset connectionError Cache on login

This commit is contained in:
Klaus Leithoff 2012-07-02 11:16:29 +00:00
parent dbc96fa181
commit 57c361fd3f
4 changed files with 36 additions and 13 deletions

View File

@ -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]))
{

View File

@ -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());

View File

@ -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"]);

View File

@ -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(