Fix performance issue in custom_displayname() when imap_cache is disabled (Bifrost#T51291)
This commit is contained in:
parent
7422273f89
commit
d331f73d01
1 changed files with 14 additions and 2 deletions
|
@ -576,11 +576,23 @@ class kolab_storage
|
||||||
*/
|
*/
|
||||||
public static function custom_displayname($folder)
|
public static function custom_displayname($folder)
|
||||||
{
|
{
|
||||||
|
static $_metadata;
|
||||||
|
|
||||||
// find custom display name in folder METADATA
|
// find custom display name in folder METADATA
|
||||||
if (self::$config->get('kolab_custom_display_names', true) && self::setup()) {
|
if (self::$config->get('kolab_custom_display_names', true) && self::setup()) {
|
||||||
|
if ($_metadata !== null) {
|
||||||
|
$metadata = $_metadata;
|
||||||
|
}
|
||||||
|
else {
|
||||||
// For performance reasons ask for all folders, it will be cached as one cache entry
|
// For performance reasons ask for all folders, it will be cached as one cache entry
|
||||||
$metadata = self::$imap->get_metadata("*", array(self::NAME_KEY_PRIVATE, self::NAME_KEY_SHARED));
|
$metadata = self::$imap->get_metadata("*", array(self::NAME_KEY_PRIVATE, self::NAME_KEY_SHARED));
|
||||||
|
|
||||||
|
// If cache is disabled store result in memory
|
||||||
|
if (!self::$config->get('imap_cache')) {
|
||||||
|
$_metadata = $metadata;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($data = $metadata[$folder]) {
|
if ($data = $metadata[$folder]) {
|
||||||
if (($name = $data[self::NAME_KEY_PRIVATE]) || ($name = $data[self::NAME_KEY_SHARED])) {
|
if (($name = $data[self::NAME_KEY_PRIVATE]) || ($name = $data[self::NAME_KEY_SHARED])) {
|
||||||
return $name;
|
return $name;
|
||||||
|
|
Loading…
Add table
Reference in a new issue