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_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,11 +916,15 @@ class mail_ui
$oA['im1'] = "folderOpen.gif";
$oA['im2'] = "MailFolderClosed.png"; // has Children
}
if ($fS['unseen'])
if ($fetchCounters)
{
$oA['text'] = $oA['text'].' ('.$fS['unseen'].')';
$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
if (!empty($fS['attributes']) && stripos(array2string($fS['attributes']),'\noselect')!== false)
@ -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) {

View File

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