From 82db8343bdcb539c237318a38a5842528c677e4f Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 11 Aug 2014 16:24:11 +0000 Subject: [PATCH] Some more speed improvements for initial load: - Avoid expensive connect in constructor for all AJAX calls (reconnect/cache used instead) - Don't verify that special folders exist for folder tree - Only fetch folder counts when fetchCounters flag is set, instead of always - Avoid some et2 warnings about not existing attributes (no speed improvement, but less annoying) --- mail/inc/class.mail_ui.inc.php | 27 +++++++++++++-------------- mail/templates/default/index.xet | 8 ++++---- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 9b88e953fd..685385333c 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -132,7 +132,7 @@ class mail_ui // . 'mail.mail_ui.ajax_refreshQuotaDisplay|' . 'mail.mail_ui.ajax_changeProfile|' . '^(?!mail)/'; - if (!preg_match($needle,$_GET['menuaction'])) + if (!preg_match($needle,$_GET['menuaction']) && !egw_json_request::isJSONRequest()) { //error_log(__METHOD__.__LINE__.' Fetched IC Server openConnection:'.self::$icServerID.'/'.$this->mail_bo->profileID.':'.function_backtrace()); //openConnection gathers SpecialUseFolderInformation and Delimiter Info @@ -793,10 +793,10 @@ class mail_ui $folderObjects = $this->mail_bo->getFolderObjects($_subscribedOnly,false,false,$_useCacheIfPossible); //$endtime = microtime(true) - $starttime; //error_log(__METHOD__.__LINE__.' Fetching folderObjects took: '.$endtime); - $trashFolder = $this->mail_bo->getTrashFolder(); - $templateFolder = $this->mail_bo->getTemplateFolder(); - $draftFolder = $this->mail_bo->getDraftFolder(); - $sentFolder = $this->mail_bo->getSentFolder(); + $trashFolder = $this->mail_bo->getTrashFolder(false); + $templateFolder = $this->mail_bo->getTemplateFolder(false); + $draftFolder = $this->mail_bo->getDraftFolder(false); + $sentFolder = $this->mail_bo->getSentFolder(false); $userDefinedFunctionFolders = array(); if (isset($trashFolder) && $trashFolder != 'none') $userDefinedFunctionFolders['Trash'] = $trashFolder; if (isset($sentFolder) && $sentFolder != 'none') $userDefinedFunctionFolders['Sent'] = $sentFolder; @@ -881,11 +881,6 @@ class mail_ui { if ($levelCt>$cmblevelsCt+1) $fetchCounters=false; } - //error_log(__METHOD__.__LINE__.' fc:'.$fetchCounters.'/'.$_fetchCounters.'('.$levelCt.'/'.$cmblevelsCt.')'.' for:'.array2string($key)); - $fS = $this->mail_bo->getFolderStatus($key,false,($fetchCounters?false:true),false); - //error_log(__METHOD__.__LINE__.'Object:'.array2string($obj)); - //error_log(__METHOD__.__LINE__.'Status:'.array2string($fS)); - //error_log(__METHOD__.__LINE__."-------------------------"); $fFP = $folderParts = explode($obj->delimiter, $key); if (in_array($key,$userDefinedFunctionFolders)) $obj->shortDisplayName = lang($obj->shortDisplayName); //get rightmost folderpart @@ -921,10 +916,14 @@ class mail_ui $oA['im1'] = "folderOpen.gif"; $oA['im2'] = "MailFolderClosed.png"; // has Children } - if ($fS['unseen']) + if ($fetchCounters) { - $oA['text'] = $oA['text'].' ('.$fS['unseen'].')'; - $oA['style'] = 'font-weight: bold'; + $count = $this->mail_bo->getMailBoxCounters($key,true); + if($count->unseen) + { + $oA['text'] = $oA['text'].' ('.$count->unseen.')'; + $oA['style'] = 'font-weight: bold'; + } } $path = $this->mail_bo->profileID.self::$delimiter.$key; $oA['id'] = $path; // ID holds the PATH @@ -3918,7 +3917,7 @@ class mail_ui if (empty($icServerID)) $icServerID = $mail->mail_bo->profileID; if ($icServerID != $mail->mail_bo->profileID) return; - $vacation = $mail->gatherVacation($cachedVacations); + $vacation = $mail->gatherVacation(); } if($vacation) { diff --git a/mail/templates/default/index.xet b/mail/templates/default/index.xet index 007344fc8e..be2bbfe180 100644 --- a/mail/templates/default/index.xet +++ b/mail/templates/default/index.xet @@ -99,10 +99,10 @@ - - - - + + + +