forked from extern/egroupware
fix excess calls of get_rows triggered by refreshFolderStatus; fix not using folderObjectCache
This commit is contained in:
parent
730eb55387
commit
7dd61b5617
@ -1731,7 +1731,7 @@ class mail_bo
|
|||||||
*/
|
*/
|
||||||
function getFolderObjects($_subscribedOnly=false, $_getCounters=false, $_alwaysGetDefaultFolders=false,$_useCacheIfPossible=true)
|
function getFolderObjects($_subscribedOnly=false, $_getCounters=false, $_alwaysGetDefaultFolders=false,$_useCacheIfPossible=true)
|
||||||
{
|
{
|
||||||
if (self::$debug) error_log(__METHOD__.__LINE__.' '."subscribedOnly:$_subscribedOnly, getCounters:$_getCounters, alwaysGetDefaultFolders:$_alwaysGetDefaultFolders");
|
if (self::$debug) error_log(__METHOD__.__LINE__.' ServerID:'.$this->icServer->ImapServerId.", subscribedOnly:$_subscribedOnly, getCounters:$_getCounters, alwaysGetDefaultFolders:$_alwaysGetDefaultFolders, _useCacheIfPossible:$_useCacheIfPossible");
|
||||||
static $folders2return;
|
static $folders2return;
|
||||||
if ($_subscribedOnly && $_getCounters===false)
|
if ($_subscribedOnly && $_getCounters===false)
|
||||||
{
|
{
|
||||||
@ -2048,8 +2048,14 @@ class mail_bo
|
|||||||
if (is_array($folders)) uasort($folders,array($this,"sortByDisplayName"));
|
if (is_array($folders)) uasort($folders,array($this,"sortByDisplayName"));
|
||||||
//$folders2return = array_merge($autoFolderObjects,$folders);
|
//$folders2return = array_merge($autoFolderObjects,$folders);
|
||||||
//_debug_array($folders2return); #exit;
|
//_debug_array($folders2return); #exit;
|
||||||
$folders2return[$this->icServer->ImapServerId] = array_merge($inboxFolderObject,$autoFolderObjects,(array)$folders);
|
$folders2return[$this->icServer->ImapServerId] = array_merge((array)$inboxFolderObject,(array)$autoFolderObjects,(array)$folders);
|
||||||
if ($_subscribedOnly && $_getCounters===false) egw_cache::setCache(egw_cache::INSTANCE,'email','folderObjects'.trim($GLOBALS['egw_info']['user']['account_id']),$folders2return,$expiration=60*60*1);
|
if (($_subscribedOnly && $_getCounters===false) ||
|
||||||
|
($_subscribedOnly == false && $_getCounters===false &&
|
||||||
|
isset($this->mailPreferences['showAllFoldersInFolderPane']) &&
|
||||||
|
$this->mailPreferences['showAllFoldersInFolderPane']==1))
|
||||||
|
{
|
||||||
|
egw_cache::setCache(egw_cache::INSTANCE,'email','folderObjects'.trim($GLOBALS['egw_info']['user']['account_id']),$folders2return,$expiration=60*60*1);
|
||||||
|
}
|
||||||
return $folders2return[$this->icServer->ImapServerId];
|
return $folders2return[$this->icServer->ImapServerId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ class mail_ui
|
|||||||
*/
|
*/
|
||||||
function index(array $content=null,$msg=null)
|
function index(array $content=null,$msg=null)
|
||||||
{
|
{
|
||||||
//$starttime = microtime (true);
|
$starttime = microtime (true);
|
||||||
$this->mail_bo->restoreSessionData();
|
$this->mail_bo->restoreSessionData();
|
||||||
$sessionFolder = $this->mail_bo->sessionData['mailbox'];
|
$sessionFolder = $this->mail_bo->sessionData['mailbox'];
|
||||||
if ($this->mail_bo->folderExists($sessionFolder))
|
if ($this->mail_bo->folderExists($sessionFolder))
|
||||||
@ -261,7 +261,10 @@ class mail_ui
|
|||||||
$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";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//$zstarttime = microtime (true);
|
||||||
$sel_options[self::$nm_index]['foldertree'] = $this->getFolderTree(false);
|
$sel_options[self::$nm_index]['foldertree'] = $this->getFolderTree(false);
|
||||||
|
//$zendtime = microtime(true) - $zstarttime;
|
||||||
|
//error_log(__METHOD__.__LINE__. " time used: ".$zendtime);
|
||||||
|
|
||||||
//$sessionFolder = $this->mail_bo->sessionData['mailbox'];// already set and tested this earlier
|
//$sessionFolder = $this->mail_bo->sessionData['mailbox'];// already set and tested this earlier
|
||||||
//if ($this->mail_bo->folderExists($sessionFolder))
|
//if ($this->mail_bo->folderExists($sessionFolder))
|
||||||
@ -349,7 +352,7 @@ class mail_ui
|
|||||||
|
|
||||||
if (empty($content[self::$nm_index]['filter2']) || empty($content[self::$nm_index]['search'])) $content[self::$nm_index]['filter2']='quick';
|
if (empty($content[self::$nm_index]['filter2']) || empty($content[self::$nm_index]['search'])) $content[self::$nm_index]['filter2']='quick';
|
||||||
$readonlys = $preserv = $sel_options;
|
$readonlys = $preserv = $sel_options;
|
||||||
//$endtime = microtime(true) - $starttime;
|
$endtime = microtime(true) - $starttime;
|
||||||
//error_log(__METHOD__.__LINE__. " time used: ".$endtime);
|
//error_log(__METHOD__.__LINE__. " time used: ".$endtime);
|
||||||
|
|
||||||
return $etpl->exec('mail.mail_ui.index',$content,$sel_options,$readonlys,$preserv);
|
return $etpl->exec('mail.mail_ui.index',$content,$sel_options,$readonlys,$preserv);
|
||||||
@ -549,7 +552,10 @@ class mail_ui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$folderObjects = $this->mail_bo->getFolderObjects(true,false,true);
|
//$starttime = microtime(true);
|
||||||
|
$folderObjects = $this->mail_bo->getFolderObjects(true,false,false,true);
|
||||||
|
//$endtime = microtime(true) - $starttime;
|
||||||
|
//error_log(__METHOD__.__LINE__.' Fetching folderObjects took: '.$endtime);
|
||||||
$trashFolder = $this->mail_bo->getTrashFolder();
|
$trashFolder = $this->mail_bo->getTrashFolder();
|
||||||
$templateFolder = $this->mail_bo->getTemplateFolder();
|
$templateFolder = $this->mail_bo->getTemplateFolder();
|
||||||
$draftFolder = $this->mail_bo->getDraftFolder();
|
$draftFolder = $this->mail_bo->getDraftFolder();
|
||||||
@ -1087,7 +1093,7 @@ class mail_ui
|
|||||||
unset($query['actions']);
|
unset($query['actions']);
|
||||||
//_debug_array($query);
|
//_debug_array($query);
|
||||||
//error_log(__METHOD__.__LINE__.array2string($query['order']).'->'.array2string($query['sort']));
|
//error_log(__METHOD__.__LINE__.array2string($query['order']).'->'.array2string($query['sort']));
|
||||||
error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Start:'.$query['start'].' NumRows:'.$query['num_rows']);
|
//error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Start:'.$query['start'].' NumRows:'.$query['num_rows']);
|
||||||
$starttime = microtime(true);
|
$starttime = microtime(true);
|
||||||
//error_log(__METHOD__.__LINE__.array2string($query['search']));
|
//error_log(__METHOD__.__LINE__.array2string($query['search']));
|
||||||
//$query['search'] is the phrase in the searchbox
|
//$query['search'] is the phrase in the searchbox
|
||||||
@ -1209,7 +1215,7 @@ error_log(__METHOD__.__LINE__.' SelectedFolder:'.$query['selectedFolder'].' Star
|
|||||||
$rows = $this->header2gridelements($sortResult['header'],$cols, $_folderName, $folderType,$previewMessage);
|
$rows = $this->header2gridelements($sortResult['header'],$cols, $_folderName, $folderType,$previewMessage);
|
||||||
//error_log(__METHOD__.__LINE__.array2string($rows));
|
//error_log(__METHOD__.__LINE__.array2string($rows));
|
||||||
$endtime = microtime(true) - $starttime;
|
$endtime = microtime(true) - $starttime;
|
||||||
error_log(__METHOD__.__LINE__. " time used: ".$endtime.' for Folder:'.$_folderName);
|
//error_log(__METHOD__.__LINE__. " time used: ".$endtime.' for Folder:'.$_folderName.' Start:'.$query['start'].' NumRows:'.$query['num_rows']);
|
||||||
|
|
||||||
return $rowsFetched['messages'];
|
return $rowsFetched['messages'];
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
this.mail_startTimerFolderStatusUpdate(this.mail_refreshTimeOut);
|
this.mail_startTimerFolderStatusUpdate(this.mail_refreshTimeOut);
|
||||||
//inital call of refresh folderstatus
|
//inital call of refresh folderstatus
|
||||||
var self = this;
|
var self = this;
|
||||||
window.setTimeout(function() {self.mail_refreshFolderStatus.apply(self);},1000);
|
window.setTimeout(function() {self.mail_refreshFolderStatus.call(self,undefined,undefined,false);},1000);
|
||||||
}
|
}
|
||||||
if (isDisplay)
|
if (isDisplay)
|
||||||
{
|
{
|
||||||
@ -500,7 +500,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
this.mail_disablePreviewArea(true);
|
this.mail_disablePreviewArea(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//console.log("mail_preview",dataElem);
|
console.log("mail_preview",dataElem);
|
||||||
this.mail_selectedMails.push(_id);
|
this.mail_selectedMails.push(_id);
|
||||||
var subject =dataElem.data.subject;
|
var subject =dataElem.data.subject;
|
||||||
this.mail_disablePreviewArea(false);
|
this.mail_disablePreviewArea(false);
|
||||||
@ -551,7 +551,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
if(_refreshTimeOut > 9999) {//we do not set _refreshTimeOut's less than 10 seconds
|
if(_refreshTimeOut > 9999) {//we do not set _refreshTimeOut's less than 10 seconds
|
||||||
var self = this;
|
var self = this;
|
||||||
this.mail_doTimedRefresh = window.setInterval(function() {
|
this.mail_doTimedRefresh = window.setInterval(function() {
|
||||||
self.mail_refreshFolderStatus.apply(self);
|
self.mail_refreshFolderStatus.call(self,undefined,undefined,true);
|
||||||
}, _refreshTimeOut);
|
}, _refreshTimeOut);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -562,9 +562,10 @@ app.classes.mail = AppJS.extend(
|
|||||||
* @param _nodeID
|
* @param _nodeID
|
||||||
* @param mode
|
* @param mode
|
||||||
*/
|
*/
|
||||||
mail_refreshFolderStatus: function(_nodeID,mode) {
|
mail_refreshFolderStatus: function(_nodeID,mode,_refreshGridArea) {
|
||||||
var nodeToRefresh = 0;
|
var nodeToRefresh = 0;
|
||||||
var mode2use = "none";
|
var mode2use = "none";
|
||||||
|
if (typeof _refreshGridArea == 'undefined') _refreshGridArea=true;
|
||||||
if (_nodeID) nodeToRefresh = _nodeID;
|
if (_nodeID) nodeToRefresh = _nodeID;
|
||||||
if (mode) {
|
if (mode) {
|
||||||
if (mode == "forced") {mode2use = mode;}
|
if (mode == "forced") {mode2use = mode;}
|
||||||
@ -576,11 +577,14 @@ app.classes.mail = AppJS.extend(
|
|||||||
var activeFolders = tree_wdg.getTreeNodeOpenItems(nodeToRefresh,mode2use);
|
var activeFolders = tree_wdg.getTreeNodeOpenItems(nodeToRefresh,mode2use);
|
||||||
//alert(activeFolders.join('#,#'));
|
//alert(activeFolders.join('#,#'));
|
||||||
this.mail_queueRefreshFolderList(activeFolders);
|
this.mail_queueRefreshFolderList(activeFolders);
|
||||||
this.mail_refreshQuotaDisplay();
|
if (_refreshGridArea)
|
||||||
// maybe to use the mode forced as trigger for grid reload and using the grids own autorefresh
|
{
|
||||||
// would solve the refresh issue more accurately
|
this.mail_refreshQuotaDisplay();
|
||||||
//if (mode == "forced") this.mail_refreshMessageGrid();
|
// maybe to use the mode forced as trigger for grid reload and using the grids own autorefresh
|
||||||
this.mail_refreshMessageGrid();
|
// would solve the refresh issue more accurately
|
||||||
|
//if (mode == "forced") this.mail_refreshMessageGrid();
|
||||||
|
this.mail_refreshMessageGrid();
|
||||||
|
}
|
||||||
} catch(e) { } // ignore the error; maybe the template is not loaded yet
|
} catch(e) { } // ignore the error; maybe the template is not loaded yet
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user