introduce static quota to make the call for quota getQuotaRoot faster within one request. ToDo: Cache it for the session

This commit is contained in:
Klaus Leithoff 2011-10-25 09:20:53 +00:00
parent 6cf8cd6dfc
commit 9091c829ba

View File

@ -3196,21 +3196,23 @@ class felamimail_bo
// return the qouta of the users INBOX
function getQuotaRoot()
{
//if (!$this->icServer->_connected) $this->openConnection($this->profileID);
static $quota;
if (isset($quota)) return $quota;
if(!$this->icServer->hasCapability('QUOTA')) {
$quota = false;
return false;
}
$quota = $this->icServer->getStorageQuotaRoot('INBOX');
//error_log(__METHOD__.__LINE__.array2string($quota));
if(is_array($quota)) {
return array(
$quota = array(
'usage' => $quota['USED'],
'limit' => $quota['QMAX'],
);
} else {
return false;
$quota = false;
}
return $quota;
}
function getDraftFolder($_checkexistance=TRUE)
@ -3373,6 +3375,7 @@ class felamimail_bo
if(($folderInfo[$_folder] instanceof PEAR_Error) || $folderInfo[$_folder] !== true)
{
$folderInfo[$_folder] = false; // set to false, whatever it was (to have a valid returnvalue for the static return)
return false;
} else {
return true;