introduce some stuff to increase inital speed of mail-list by asyncronously calling gatherVacation and getQuotaRoot; increase cache-time on folderExists cache, trust a folder to be existant (or at least fot force the check with IMAP-Server) in get_rows

This commit is contained in:
Klaus Leithoff 2014-08-05 08:51:26 +00:00
parent dcc6166212
commit 1bb1d18997
2 changed files with 12 additions and 52 deletions

View File

@ -513,6 +513,7 @@ class mail_hooks
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
$appname = 'mail';
$menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu');
/*
$file = array();
$profileID = 0;
if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']))
@ -545,6 +546,7 @@ class mail_hooks
//error_log(__METHOD__.__LINE__.' Key:'.$tmpkey.'->'.array2string($identities[$icServers->acc_id]));
}
}
*/
$file=array();
// Destination div for folder tree
$file[] = array(
@ -584,51 +586,7 @@ class mail_hooks
}
// display them all
display_sidebox($appname,$menu_title,$file);
/*
unset($file);
if ($preferences && $sieveEnabledServerCounter)
{
$menu_title = lang('Sieve');
$linkData = array
(
'menuaction' => 'mail.mail_sieve.index',
'ajax' => 'true'
);
if(empty($preferences['prefpreventeditfilterrules']) || $preferences['prefpreventeditfilterrules'] == 0)
$file['filter rules'] = egw::link('/index.php',$linkData);
$linkData = array
(
'menuaction' => 'mail.mail_sieve.editVacation',
'ajax' => 'true'
);
if(empty($preferences['prefpreventabsentnotice']) || $preferences['prefpreventabsentnotice'] == 0)
{
$file['vacation notice'] = egw::link('/index.php',$linkData);
}
if((empty($preferences['prefpreventnotificationformailviaemail']) ||
$preferences['prefpreventnotificationformailviaemail'] == 0))
{
$file['email notification'] = egw::link('/index.php','menuaction=mail.mail_sieve.editEmailNotification&ajax=true'); //Added email notifications
}
if ($sieveEnabledServerCounter>=1)
{
if($sieveEnabledServerCounter==1 && ($icServer instanceof defaultimap)) {
if($icServer->enableSieve)
{
if (count($file)) display_sidebox($appname,$menu_title,$file);
unset($file);
}
}
else
{
if (count($file)) display_sidebox($appname,$menu_title,$file);
unset($file);
}
}
}
*/
if ($GLOBALS['egw_info']['user']['apps']['admin'])
{
$file = Array(

View File

@ -440,9 +440,8 @@ class mail_ui
unset($msg);
unset($content['msg']);
}
$quota = $this->mail_bo->getQuotaRoot();
// call getQuotaRoot asynchronously in getRows by initiating a client Server roundtrip
$quota = false;//$this->mail_bo->getQuotaRoot();
if($quota !== false && $quota['limit'] != 'NOT SET') {
$quotainfo = $this->quotaDisplay($quota['usage'], $quota['limit']);
$content[self::$nm_index]['quota'] = $sel_options[self::$nm_index]['quota'] = $quotainfo['text'];
@ -454,8 +453,8 @@ class mail_ui
$content[self::$nm_index]['quotaclass'] = $sel_options[self::$nm_index]['quotaclass'] = "mail_DisplayNone";
$content[self::$nm_index]['quotanotsupported'] = $sel_options[self::$nm_index]['quotanotsupported'] = "mail_DisplayNone";
}
$vacation = $this->gatherVacation();
// call gatherVacation asynchronously in getRows by initiating a client Server roundtrip
$vacation = false;//$this->gatherVacation();
//error_log(__METHOD__.__LINE__.' Server:'.self::$icServerID.' Sieve Enabled:'.array2string($vacation));
if($vacation) {
if (is_array($vacation) && ($vacation['status'] == 'on' || $vacation['status']=='by_date'))
@ -1478,13 +1477,13 @@ class mail_ui
//save selected Folder to sessionData (mailbox)->currentFolder
if (isset($query['selectedFolder'])) $this->mail_bo->sessionData['mailbox']=$_folderName;
$toSchema = false;//decides to select list schema with column to selected (if false fromaddress is default)
if ($this->mail_bo->folderExists($_folderName,true))
if ($this->mail_bo->folderExists($_folderName))
{
$toSchema = $this->mail_bo->isDraftFolder($_folderName)||$this->mail_bo->isSentFolder($_folderName)||$this->mail_bo->isTemplateFolder($_folderName);
}
else
{
error_log(__METHOD__.__LINE__.' Test on Folder:'.$_folderName.' failed; Using INBOX instead');
//error_log(__METHOD__.__LINE__.' Test on Folder:'.$_folderName.' failed; Using INBOX instead');
$query['selectedFolder']=$this->mail_bo->sessionData['mailbox']=$_folderName='INBOX';
}
$this->mail_bo->saveSessionData();
@ -1576,13 +1575,16 @@ class mail_ui
$sR=array();
self::callWizard($e->getMessage(), false);
}
$response = egw_json_response::get();
// unlock immediately after fetching the rows
if (stripos($_GET['menuaction'],'ajax_get_rows')!==false)
{
//error_log(__METHOD__.__LINE__.' unlock tree ->'.$_GET['menuaction']);
$response = egw_json_response::get();
$response->call('app.mail.unlock_tree');
}
// done asynchronously initiating a client->server roundtrip to save time on the initial call
$response->call('app.mail.mail_callRefreshVacationNotice',$this->mail_bo->profileID);
$response->call('app.mail.mail_refreshQuotaDisplay',$this->mail_bo->profileID);
if (is_array($sR) && count($sR)>0)
{
foreach ((array)$sR as $key => $v)