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']); unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
$appname = 'mail'; $appname = 'mail';
$menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu'); $menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu');
/*
$file = array(); $file = array();
$profileID = 0; $profileID = 0;
if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'])) 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])); //error_log(__METHOD__.__LINE__.' Key:'.$tmpkey.'->'.array2string($identities[$icServers->acc_id]));
} }
} }
*/
$file=array(); $file=array();
// Destination div for folder tree // Destination div for folder tree
$file[] = array( $file[] = array(
@ -584,51 +586,7 @@ class mail_hooks
} }
// display them all // display them all
display_sidebox($appname,$menu_title,$file); 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']) if ($GLOBALS['egw_info']['user']['apps']['admin'])
{ {
$file = Array( $file = Array(

View File

@ -440,9 +440,8 @@ class mail_ui
unset($msg); unset($msg);
unset($content['msg']); unset($content['msg']);
} }
// call getQuotaRoot asynchronously in getRows by initiating a client Server roundtrip
$quota = $this->mail_bo->getQuotaRoot(); $quota = false;//$this->mail_bo->getQuotaRoot();
if($quota !== false && $quota['limit'] != 'NOT SET') { if($quota !== false && $quota['limit'] != 'NOT SET') {
$quotainfo = $this->quotaDisplay($quota['usage'], $quota['limit']); $quotainfo = $this->quotaDisplay($quota['usage'], $quota['limit']);
$content[self::$nm_index]['quota'] = $sel_options[self::$nm_index]['quota'] = $quotainfo['text']; $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]['quotaclass'] = $sel_options[self::$nm_index]['quotaclass'] = "mail_DisplayNone";
$content[self::$nm_index]['quotanotsupported'] = $sel_options[self::$nm_index]['quotanotsupported'] = "mail_DisplayNone"; $content[self::$nm_index]['quotanotsupported'] = $sel_options[self::$nm_index]['quotanotsupported'] = "mail_DisplayNone";
} }
// call gatherVacation asynchronously in getRows by initiating a client Server roundtrip
$vacation = $this->gatherVacation(); $vacation = false;//$this->gatherVacation();
//error_log(__METHOD__.__LINE__.' Server:'.self::$icServerID.' Sieve Enabled:'.array2string($vacation)); //error_log(__METHOD__.__LINE__.' Server:'.self::$icServerID.' Sieve Enabled:'.array2string($vacation));
if($vacation) { if($vacation) {
if (is_array($vacation) && ($vacation['status'] == 'on' || $vacation['status']=='by_date')) 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 //save selected Folder to sessionData (mailbox)->currentFolder
if (isset($query['selectedFolder'])) $this->mail_bo->sessionData['mailbox']=$_folderName; 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) $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); $toSchema = $this->mail_bo->isDraftFolder($_folderName)||$this->mail_bo->isSentFolder($_folderName)||$this->mail_bo->isTemplateFolder($_folderName);
} }
else 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'; $query['selectedFolder']=$this->mail_bo->sessionData['mailbox']=$_folderName='INBOX';
} }
$this->mail_bo->saveSessionData(); $this->mail_bo->saveSessionData();
@ -1576,13 +1575,16 @@ class mail_ui
$sR=array(); $sR=array();
self::callWizard($e->getMessage(), false); self::callWizard($e->getMessage(), false);
} }
$response = egw_json_response::get();
// unlock immediately after fetching the rows // unlock immediately after fetching the rows
if (stripos($_GET['menuaction'],'ajax_get_rows')!==false) if (stripos($_GET['menuaction'],'ajax_get_rows')!==false)
{ {
//error_log(__METHOD__.__LINE__.' unlock tree ->'.$_GET['menuaction']); //error_log(__METHOD__.__LINE__.' unlock tree ->'.$_GET['menuaction']);
$response = egw_json_response::get();
$response->call('app.mail.unlock_tree'); $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) if (is_array($sR) && count($sR)>0)
{ {
foreach ((array)$sR as $key => $v) foreach ((array)$sR as $key => $v)