mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-17 05:23:13 +01:00
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:
parent
baa5e4cdbc
commit
301e71f432
@ -466,6 +466,7 @@ class emailadmin_imapbase
|
|||||||
* 1) icServerIMAP_connectionError
|
* 1) icServerIMAP_connectionError
|
||||||
* 2) icServerSIEVE_connectionError
|
* 2) icServerSIEVE_connectionError
|
||||||
* 3) INSTANCE OF MAIL_BO
|
* 3) INSTANCE OF MAIL_BO
|
||||||
|
* 4) HierarchyDelimiter
|
||||||
*
|
*
|
||||||
* @param int $_profileID=null default profile of user as returned by getUserDefaultProfileID
|
* @param int $_profileID=null default profile of user as returned by getUserDefaultProfileID
|
||||||
* @return void
|
* @return void
|
||||||
@ -483,6 +484,12 @@ class emailadmin_imapbase
|
|||||||
unset($rawHeadersCache[$_profileID]);
|
unset($rawHeadersCache[$_profileID]);
|
||||||
egw_cache::setCache(egw_cache::INSTANCE,'email','rawHeadersCache'.trim($GLOBALS['egw_info']['user']['account_id']),$rawHeadersCache, $expiration=60*60*1);
|
egw_cache::setCache(egw_cache::INSTANCE,'email','rawHeadersCache'.trim($GLOBALS['egw_info']['user']['account_id']),$rawHeadersCache, $expiration=60*60*1);
|
||||||
}
|
}
|
||||||
|
$HierarchyDelimiterCache = egw_cache::getCache(egw_cache::INSTANCE,'email','HierarchyDelimiter'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*24*5);
|
||||||
|
if (isset($HierarchyDelimiterCache[$_profileID]))
|
||||||
|
{
|
||||||
|
unset($HierarchyDelimiterCache[$_profileID]);
|
||||||
|
egw_cache::setCache(egw_cache::INSTANCE,'email','HierarchyDelimiter'.trim($GLOBALS['egw_info']['user']['account_id']),$HierarchyDelimiterCache, $expiration=60*60*24*5);
|
||||||
|
}
|
||||||
//reset folderObject cache, to trigger reload
|
//reset folderObject cache, to trigger reload
|
||||||
self::resetFolderObjectCache($_profileID);
|
self::resetFolderObjectCache($_profileID);
|
||||||
//reset counter of deleted messages per folder
|
//reset counter of deleted messages per folder
|
||||||
@ -556,7 +563,7 @@ class emailadmin_imapbase
|
|||||||
{
|
{
|
||||||
unset($folders2return[$_ImapServerId]);
|
unset($folders2return[$_ImapServerId]);
|
||||||
}
|
}
|
||||||
$folderInfo = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerFolderExistsInfo'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*5);
|
$folderInfo = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerFolderExistsInfo'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*60*5);
|
||||||
if (isset($folderInfo[$_ImapServerId]))
|
if (isset($folderInfo[$_ImapServerId]))
|
||||||
{
|
{
|
||||||
unset($folderInfo[$_ImapServerId]);
|
unset($folderInfo[$_ImapServerId]);
|
||||||
@ -581,7 +588,7 @@ class emailadmin_imapbase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
egw_cache::setCache(egw_cache::INSTANCE,'email','folderObjects'.trim($GLOBALS['egw_info']['user']['account_id']),$folders2return, $expiration=60*60*1);
|
egw_cache::setCache(egw_cache::INSTANCE,'email','folderObjects'.trim($GLOBALS['egw_info']['user']['account_id']),$folders2return, $expiration=60*60*1);
|
||||||
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerFolderExistsInfo'.trim($GLOBALS['egw_info']['user']['account_id']),$folderInfo,$expiration=60*5);
|
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerFolderExistsInfo'.trim($GLOBALS['egw_info']['user']['account_id']),$folderInfo,$expiration=60*60*5);
|
||||||
//egw_cache::setCache(egw_cache::INSTANCE,'email','lastFolderUsedForMove'.trim($GLOBALS['egw_info']['user']['account_id']),$lastFolderUsedForMove,$expiration=60*60*1);
|
//egw_cache::setCache(egw_cache::INSTANCE,'email','lastFolderUsedForMove'.trim($GLOBALS['egw_info']['user']['account_id']),$lastFolderUsedForMove,$expiration=60*60*1);
|
||||||
egw_cache::setCache(egw_cache::INSTANCE,'email','folderBasicInfo'.trim($GLOBALS['egw_info']['user']['account_id']),$folderBasicInfo,$expiration=60*60*1);
|
egw_cache::setCache(egw_cache::INSTANCE,'email','folderBasicInfo'.trim($GLOBALS['egw_info']['user']['account_id']),$folderBasicInfo,$expiration=60*60*1);
|
||||||
egw_cache::setCache(egw_cache::INSTANCE,'email','specialUseFolders'.trim($GLOBALS['egw_info']['user']['account_id']),$_specialUseFolders,$expiration=60*60*12);
|
egw_cache::setCache(egw_cache::INSTANCE,'email','specialUseFolders'.trim($GLOBALS['egw_info']['user']['account_id']),$_specialUseFolders,$expiration=60*60*12);
|
||||||
@ -2098,6 +2105,8 @@ class emailadmin_imapbase
|
|||||||
{
|
{
|
||||||
throw new egw_exception(__METHOD__." failed for $oldFolderName (rename to: $newFolderName) with error:".$e->getMessage());;
|
throw new egw_exception(__METHOD__." failed for $oldFolderName (rename to: $newFolderName) with error:".$e->getMessage());;
|
||||||
}
|
}
|
||||||
|
// clear FolderExistsInfoCache
|
||||||
|
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerFolderExistsInfo'.trim($GLOBALS['egw_info']['user']['account_id']),$folderInfo,$expiration=60*60*5);
|
||||||
|
|
||||||
return $newFolderName;
|
return $newFolderName;
|
||||||
|
|
||||||
@ -2122,6 +2131,8 @@ class emailadmin_imapbase
|
|||||||
{
|
{
|
||||||
throw new egw_exception("Deleting Folder $_foldername failed! Error:".$e->getMessage());;
|
throw new egw_exception("Deleting Folder $_foldername failed! Error:".$e->getMessage());;
|
||||||
}
|
}
|
||||||
|
// clear FolderExistsInfoCache
|
||||||
|
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerFolderExistsInfo'.trim($GLOBALS['egw_info']['user']['account_id']),$folderInfo,$expiration=60*60*5);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3049,9 +3060,9 @@ class emailadmin_imapbase
|
|||||||
if ($_forceCheck===true) error_log(__METHOD__.' ('.__LINE__.') '.' Called with empty Folder:'.$_folder.function_backtrace());
|
if ($_forceCheck===true) error_log(__METHOD__.' ('.__LINE__.') '.' Called with empty Folder:'.$_folder.function_backtrace());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// reduce traffic within the Instance per User; Expire every 5 Minutes
|
// reduce traffic within the Instance per User; Expire every 5 hours
|
||||||
//error_log(__METHOD__.' ('.__LINE__.') '.' Called with Folder:'.$_folder.function_backtrace());
|
//error_log(__METHOD__.' ('.__LINE__.') '.' Called with Folder:'.$_folder.function_backtrace());
|
||||||
if (is_null($folderInfo)) $folderInfo = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerFolderExistsInfo'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*5);
|
if (is_null($folderInfo)) $folderInfo = egw_cache::getCache(egw_cache::INSTANCE,'email','icServerFolderExistsInfo'.trim($GLOBALS['egw_info']['user']['account_id']),null,array(),$expiration=60*60*5);
|
||||||
//error_log(__METHOD__.' ('.__LINE__.') '.'Cached Info on Folder:'.$_folder.' for Profile:'.$this->profileID.($forceCheck?'(forcedCheck)':'').':'.array2string($folderInfo));
|
//error_log(__METHOD__.' ('.__LINE__.') '.'Cached Info on Folder:'.$_folder.' for Profile:'.$this->profileID.($forceCheck?'(forcedCheck)':'').':'.array2string($folderInfo));
|
||||||
if (!empty($folderInfo) && isset($folderInfo[$this->profileID]) && isset($folderInfo[$this->profileID][$_folder]) && $forceCheck===false)
|
if (!empty($folderInfo) && isset($folderInfo[$this->profileID]) && isset($folderInfo[$this->profileID][$_folder]) && $forceCheck===false)
|
||||||
{
|
{
|
||||||
@ -3090,7 +3101,7 @@ class emailadmin_imapbase
|
|||||||
{
|
{
|
||||||
$folderInfo[$this->profileID][$_folder] = false; // set to false, whatever it was (to have a valid returnvalue for the static return)
|
$folderInfo[$this->profileID][$_folder] = false; // set to false, whatever it was (to have a valid returnvalue for the static return)
|
||||||
}
|
}
|
||||||
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerFolderExistsInfo'.trim($GLOBALS['egw_info']['user']['account_id']),$folderInfo,$expiration=60*5);
|
egw_cache::setCache(egw_cache::INSTANCE,'email','icServerFolderExistsInfo'.trim($GLOBALS['egw_info']['user']['account_id']),$folderInfo,$expiration=60*60*5);
|
||||||
return (!empty($folderInfo) && isset($folderInfo[$this->profileID][$_folder]) ? $folderInfo[$this->profileID][$_folder] : false);
|
return (!empty($folderInfo) && isset($folderInfo[$this->profileID][$_folder]) ? $folderInfo[$this->profileID][$_folder] : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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(
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user