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)
This commit is contained in:
Nathan Gray 2014-08-11 16:24:11 +00:00
parent 672297df94
commit 82db8343bd
2 changed files with 17 additions and 18 deletions

View File

@ -132,7 +132,7 @@ class mail_ui
// . 'mail.mail_ui.ajax_refreshQuotaDisplay|' // . 'mail.mail_ui.ajax_refreshQuotaDisplay|'
. 'mail.mail_ui.ajax_changeProfile|' . 'mail.mail_ui.ajax_changeProfile|'
. '^(?!mail)/'; . '^(?!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()); //error_log(__METHOD__.__LINE__.' Fetched IC Server openConnection:'.self::$icServerID.'/'.$this->mail_bo->profileID.':'.function_backtrace());
//openConnection gathers SpecialUseFolderInformation and Delimiter Info //openConnection gathers SpecialUseFolderInformation and Delimiter Info
@ -793,10 +793,10 @@ class mail_ui
$folderObjects = $this->mail_bo->getFolderObjects($_subscribedOnly,false,false,$_useCacheIfPossible); $folderObjects = $this->mail_bo->getFolderObjects($_subscribedOnly,false,false,$_useCacheIfPossible);
//$endtime = microtime(true) - $starttime; //$endtime = microtime(true) - $starttime;
//error_log(__METHOD__.__LINE__.' Fetching folderObjects took: '.$endtime); //error_log(__METHOD__.__LINE__.' Fetching folderObjects took: '.$endtime);
$trashFolder = $this->mail_bo->getTrashFolder(); $trashFolder = $this->mail_bo->getTrashFolder(false);
$templateFolder = $this->mail_bo->getTemplateFolder(); $templateFolder = $this->mail_bo->getTemplateFolder(false);
$draftFolder = $this->mail_bo->getDraftFolder(); $draftFolder = $this->mail_bo->getDraftFolder(false);
$sentFolder = $this->mail_bo->getSentFolder(); $sentFolder = $this->mail_bo->getSentFolder(false);
$userDefinedFunctionFolders = array(); $userDefinedFunctionFolders = array();
if (isset($trashFolder) && $trashFolder != 'none') $userDefinedFunctionFolders['Trash'] = $trashFolder; if (isset($trashFolder) && $trashFolder != 'none') $userDefinedFunctionFolders['Trash'] = $trashFolder;
if (isset($sentFolder) && $sentFolder != 'none') $userDefinedFunctionFolders['Sent'] = $sentFolder; if (isset($sentFolder) && $sentFolder != 'none') $userDefinedFunctionFolders['Sent'] = $sentFolder;
@ -881,11 +881,6 @@ class mail_ui
{ {
if ($levelCt>$cmblevelsCt+1) $fetchCounters=false; 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); $fFP = $folderParts = explode($obj->delimiter, $key);
if (in_array($key,$userDefinedFunctionFolders)) $obj->shortDisplayName = lang($obj->shortDisplayName); if (in_array($key,$userDefinedFunctionFolders)) $obj->shortDisplayName = lang($obj->shortDisplayName);
//get rightmost folderpart //get rightmost folderpart
@ -921,10 +916,14 @@ class mail_ui
$oA['im1'] = "folderOpen.gif"; $oA['im1'] = "folderOpen.gif";
$oA['im2'] = "MailFolderClosed.png"; // has Children $oA['im2'] = "MailFolderClosed.png"; // has Children
} }
if ($fS['unseen']) if ($fetchCounters)
{ {
$oA['text'] = $oA['text'].' ('.$fS['unseen'].')'; $count = $this->mail_bo->getMailBoxCounters($key,true);
$oA['style'] = 'font-weight: bold'; if($count->unseen)
{
$oA['text'] = $oA['text'].' ('.$count->unseen.')';
$oA['style'] = 'font-weight: bold';
}
} }
$path = $this->mail_bo->profileID.self::$delimiter.$key; $path = $this->mail_bo->profileID.self::$delimiter.$key;
$oA['id'] = $path; // ID holds the PATH $oA['id'] = $path; // ID holds the PATH
@ -3918,7 +3917,7 @@ class mail_ui
if (empty($icServerID)) $icServerID = $mail->mail_bo->profileID; if (empty($icServerID)) $icServerID = $mail->mail_bo->profileID;
if ($icServerID != $mail->mail_bo->profileID) return; if ($icServerID != $mail->mail_bo->profileID) return;
$vacation = $mail->gatherVacation($cachedVacations); $vacation = $mail->gatherVacation();
} }
if($vacation) { if($vacation) {

View File

@ -99,10 +99,10 @@
<description id="${row}[winmailFlag]" /> <description id="${row}[winmailFlag]" />
<description class="et2_link" id="${row}[filename]" no_lang="1" onclick="app.mail.displayAttachment"/> <description class="et2_link" id="${row}[filename]" no_lang="1" onclick="app.mail.displayAttachment"/>
<description align="right" id="${row}[size]" /> <description align="right" id="${row}[size]" />
<buttononly id="${row}[save]" value="save" image="fileexport" onclick="app.mail.saveAttachment"/> <buttononly id="${row}[save]" image="fileexport" onclick="app.mail.saveAttachment"/>
<buttononly id="${row}[saveAsVFS]" value="save" image="filemanager/navbar" onclick="app.mail.saveAttachmentToVFS"/> <buttononly id="${row}[saveAsVFS]" image="filemanager/navbar" onclick="app.mail.saveAttachmentToVFS"/>
<buttononly class="$row_cont[classSaveAllPossiblyDisabled]" id="${row}[save_all]" value="save_all" image="mail/save_all" onclick="app.mail.saveAllAttachmentsToVFS"/> <buttononly class="$row_cont[classSaveAllPossiblyDisabled]" id="${row}[save_all]" image="mail/save_all" onclick="app.mail.saveAllAttachmentsToVFS"/>
<buttononly class="$row_cont[classSaveAllPossiblyDisabled]" id="${row}[save_zip]" value="save_zip" image="mail/save_zip" onclick="app.mail.saveAllAttachmentsToZip" label="Save as Zip"/> <buttononly class="$row_cont[classSaveAllPossiblyDisabled]" id="${row}[save_zip]" image="mail/save_zip" onclick="app.mail.saveAllAttachmentsToZip" label="Save as Zip"/>
</row> </row>
</rows> </rows>
</grid> </grid>