more debug for times; getFolderObjects and getFolderTree

This commit is contained in:
Klaus Leithoff 2014-02-27 16:47:23 +00:00
parent 5c460201f0
commit b8801d64e5
2 changed files with 11 additions and 4 deletions

View File

@ -706,6 +706,7 @@ class mail_bo
{
//error_log( "-------------------------->open connection ".function_backtrace());
//error_log(__METHOD__.__LINE__.' ->'.array2string($this->icServer));
if (self::$debugTimes) $starttime = microtime (true);
$mailbox=null;
if($this->folderExists($this->sessionData['mailbox'])) $mailbox = $this->sessionData['mailbox'];
if (empty($mailbox)) $mailbox = $this->icServer->getCurrentMailbox();
@ -728,6 +729,7 @@ class mail_bo
//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);
self::$specialUseFolders = $this->getSpecialUseFolders();
if (self::$debugTimes) self::logRunTimes($starttime,null,'ProfileID:'.$_icServerID,__METHOD__.__LINE__);
}
/**
@ -1956,12 +1958,14 @@ class mail_bo
function getFolderObjects($_subscribedOnly=false, $_getCounters=false, $_alwaysGetDefaultFolders=false,$_useCacheIfPossible=true)
{
if (self::$debug) error_log(__METHOD__.__LINE__.' ServerID:'.$this->icServer->ImapServerId.", subscribedOnly:$_subscribedOnly, getCounters:$_getCounters, alwaysGetDefaultFolders:$_alwaysGetDefaultFolders, _useCacheIfPossible:$_useCacheIfPossible");
if (self::$debugTimes) $starttime = microtime (true);
static $folders2return;
// always use static on single request if info is available;
// so if you require subscribed/unsubscribed results on a single request you MUST
// set $_useCacheIfPossible to false !
if ($_useCacheIfPossible && isset($folders2return[$this->icServer->ImapServerId]) && !empty($folders2return[$this->icServer->ImapServerId]))
{
if (self::$debugTimes) self::logRunTimes($starttime,null,'using static',__METHOD__.__LINE__);
return $folders2return[$this->icServer->ImapServerId];
}
@ -1971,6 +1975,7 @@ class mail_bo
if ($_useCacheIfPossible && isset($folders2return[$this->icServer->ImapServerId]) && !empty($folders2return[$this->icServer->ImapServerId]))
{
//error_log(__METHOD__.__LINE__.' using Cached folderObjects'.array2string($folders2return[$this->icServer->ImapServerId]));
if (self::$debugTimes) self::logRunTimes($starttime,null,'from Cache',__METHOD__.__LINE__);
return $folders2return[$this->icServer->ImapServerId];
}
}
@ -2310,6 +2315,7 @@ class mail_bo
{
egw_cache::setCache(egw_cache::INSTANCE,'email','folderObjects'.trim($GLOBALS['egw_info']['user']['account_id']),$folders2return,$expiration=60*60*1);
}
if (self::$debugTimes) self::logRunTimes($starttime,null,function_backtrace(),__METHOD__.__LINE__);
return $folders2return[$this->icServer->ImapServerId];
}

View File

@ -325,7 +325,7 @@ class mail_ui
function index(array $content=null,$msg=null)
{
//error_log(__METHOD__.__LINE__.function_backtrace());
$starttime = microtime (true);
if (mail_bo::$debugTimes) $starttime = microtime (true);
$this->mail_bo->restoreSessionData();
$sessionFolder = $this->mail_bo->sessionData['mailbox'];
//$toSchema = false;//decides to select list schema with column to selected (if false fromaddress is default)
@ -587,9 +587,7 @@ class mail_ui
if (empty($content[self::$nm_index]['filter2']) || empty($content[self::$nm_index]['search'])) $content[self::$nm_index]['filter2']='quick';
$readonlys = $preserv = $sel_options;
$endtime = microtime(true) - $starttime;
//error_log(__METHOD__.__LINE__. " time used: ".$endtime);
if (mail_bo::$debugTimes) mail_bo::logRunTimes($starttime,null,'',__METHOD__.__LINE__);
return $etpl->exec('mail.mail_ui.index',$content,$sel_options,$readonlys,$preserv);
}
@ -777,6 +775,7 @@ class mail_ui
*/
function getFolderTree($_fetchCounters=false, $_nodeID=null, $_subscribedOnly=true, $_returnNodeOnly=true)
{
if (mail_bo::$debugTimes) $starttime = microtime (true);
if (!is_null($_nodeID) && $_nodeID !=0)
{
list($_profileID,$_folderName) = explode(self::$delimiter,$_nodeID,2);
@ -906,8 +905,10 @@ class mail_ui
{
$node = self::findNode($out,$_nodeID);
//error_log(__METHOD__.__LINE__.':'.$_nodeID.'->'.array2string($node));
if (mail_bo::$debugTimes) mail_bo::logRunTimes($starttime,null,'return subtree for:'.$_nodeID,__METHOD__.__LINE__);
return $node;
}
if (mail_bo::$debugTimes) mail_bo::logRunTimes($starttime,null,function_backtrace(),__METHOD__.__LINE__);
return ($c?$out:array('id'=>0, 'item'=>array('text'=>'INBOX','tooltip'=>'INBOX'.' '.lang('(not connected)'),'im0'=>'kfm_home.png')));
}