gather specialUseFolderInformation

This commit is contained in:
Klaus Leithoff 2013-10-30 12:21:28 +00:00
parent 6d4de6abb1
commit 7e0f61f8d9
2 changed files with 2 additions and 49 deletions

View File

@ -580,51 +580,6 @@ $_restoreSession=false;
*/ */
function openConnection($_icServerID=0, $_adminConnection=false) function openConnection($_icServerID=0, $_adminConnection=false)
{ {
static $isError;
if ($_icServerID==0 && !empty($this->profileID))$_icServerID = $this->profileID;
//error_log(__METHOD__.__LINE__.'->'.$_icServerID.' called from '.function_backtrace());
if (is_null($isError)) $isError = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*5);
if ( isset($isError[$_icServerID]) || (($this->icServer instanceof defaultimap) && PEAR::isError($this->icServer->_connectionErrorObject)))
{
if (trim($isError[$_icServerID])==',' || trim($this->icServer->_connectionErrorObject->message) == ',')
{
//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))
{
if (self::$debug) error_log(__METHOD__." No Object for MailPreferences found.". function_backtrace());
$this->errorMessage .= lang('No valid data to create MailProfile!!');
$isError[$_icServerID] = (($this->icServer instanceof defaultimap)?new PEAR_Error($this->errorMessage):$this->errorMessage);
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isError,$expiration=60*15);
return false;
}
if(!$this->icServer = $this->mailPreferences->getIncomingServer((int)$_icServerID)) {
$this->errorMessage .= lang('No active IMAP server found!!');
$isError[$_icServerID] = $this->errorMessage;
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isError,$expiration=60*15);
return false;
}
//error_log(__METHOD__.__LINE__.'->'.array2string($this->icServer->ImapServerId));
if ($this->icServer && empty($this->icServer->host)) {
$errormessage = lang('No IMAP server host configured!!');
if ($GLOBALS['egw_info']['user']['apps']['emailadmin']) {
$errormessage .= "<br>".lang("Configure a valid IMAP Server in emailadmin for the profile you are using.");
} else {
$errormessage .= "<br>".lang('Please ask the administrator to correct the emailadmin IMAP Server Settings for you.');
}
$this->icServer->_connectionErrorObject->message .= $this->errorMessage .= $errormessage;
$isError[$_icServerID] = $this->errorMessage;
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isError,$expiration=60*15);
return false;
}
//error_log( "-------------------------->open connection ".function_backtrace()); //error_log( "-------------------------->open connection ".function_backtrace());
//error_log(__METHOD__.__LINE__.' ->'.array2string($this->icServer)); //error_log(__METHOD__.__LINE__.' ->'.array2string($this->icServer));
$tretval = $this->icServer->openMailbox($this->icServer->currentMailbox); $tretval = $this->icServer->openMailbox($this->icServer->currentMailbox);
@ -632,8 +587,6 @@ $_restoreSession=false;
//error_log(__METHOD__." using existing Connection ProfileID:".$_icServerID.' Status:'.print_r($this->icServer->_connected,true)); //error_log(__METHOD__." using existing Connection ProfileID:".$_icServerID.' Status:'.print_r($this->icServer->_connected,true));
//error_log(__METHOD__.__LINE__."->open connection for Server with profileID:".$_icServerID.function_backtrace()); //error_log(__METHOD__.__LINE__."->open connection for Server with profileID:".$_icServerID.function_backtrace());
if ( PEAR::isError($tretval) ) egw_cache::setCache(egw_cache::INSTANCE,'email','icServerIMAP_connectionError'.trim($GLOBALS['egw_info']['user']['account_id']),$isError,$expiration=60*15);
//error_log(print_r($this->icServer->_connected,true));
//make sure we are working with the correct hierarchyDelimiter on the current connection, calling getHierarchyDelimiter with false to reset the cache //make sure we are working with the correct hierarchyDelimiter on the current connection, calling getHierarchyDelimiter with false to reset the cache
$hD = $this->getHierarchyDelimiter(false); $hD = $this->getHierarchyDelimiter(false);
self::$specialUseFolders = $this->getSpecialUseFolders(); self::$specialUseFolders = $this->getSpecialUseFolders();

View File

@ -143,7 +143,7 @@ class mail_ui
self::$icServerID = $_icServerID; self::$icServerID = $_icServerID;
if ($unsetCache) emailadmin_bo::unsetCachedObjects(self::$icServerID); if ($unsetCache) emailadmin_bo::unsetCachedObjects(self::$icServerID);
$this->mail_bo = mail_bo::getInstance(false,self::$icServerID); $this->mail_bo = mail_bo::getInstance(false,self::$icServerID);
if (mail_bo::$debug) error_log(__METHOD__.__LINE__.' Fetched IC Server:'.self::$icServerID.'/'.$this->mail_bo->profileID.':'.function_backtrace()); if (mail_bo::$debug); error_log(__METHOD__.__LINE__.' Fetched IC Server:'.self::$icServerID.'/'.$this->mail_bo->profileID.':'.function_backtrace());
// no icServer Object: something failed big time // no icServer Object: something failed big time
if (!isset($this->mail_bo->icServer) || $this->mail_bo->icServer->ImapServerId<>$_icServerID) exit; // ToDo: Exception or the dialog for setting up a server config if (!isset($this->mail_bo->icServer) || $this->mail_bo->icServer->ImapServerId<>$_icServerID) exit; // ToDo: Exception or the dialog for setting up a server config
/*if (!($this->mail_bo->icServer->_connected == 1))*/ $this->mail_bo->reopen('INBOX'); /*if (!($this->mail_bo->icServer->_connected == 1))*/ $this->mail_bo->reopen('INBOX');
@ -475,7 +475,7 @@ class mail_ui
list($_profileID,$_folderName) = explode(self::$delimiter,$nodeID,2); list($_profileID,$_folderName) = explode(self::$delimiter,$nodeID,2);
if (!empty($_folderName)) $fetchCounters = true; if (!empty($_folderName)) $fetchCounters = true;
$data = $this->getFolderTree($fetchCounters, $nodeID); $data = $this->getFolderTree($fetchCounters, $nodeID);
//error_log(__METHOD__.__LINE__.':'.$nodeID.'->'.array2string($data)); error_log(__METHOD__.__LINE__.':'.$nodeID.'->'.array2string($data));
if (!is_null($_nodeID)) return $data; if (!is_null($_nodeID)) return $data;
header('Content-Type: application/json; charset=utf-8'); header('Content-Type: application/json; charset=utf-8');
echo json_encode($data); echo json_encode($data);