Remove folder typedata in-memory cache
Summary: This caused the syncroton Ping command to miss new task folders. Because the Ping command is long running we use: rcube::get_instance()->get_storage()->clear_cache('mailboxes', true); To clear the cache before listing the folders. However, this doesn't clear the in-memory cache in kolab_storage. In list_folders we then ended up in the branch returning the folder list directly from that outdated in-memory cache and thus missed the update. Since we already cache the folder list and metadata it doesn't seem necessary to cache it again. Removing it thus gives us a single place to invalidate it. Differential Revision: https://git.kolab.org/D2143
This commit is contained in:
parent
d4c00a9555
commit
b4b3a48893
1 changed files with 3 additions and 18 deletions
|
@ -47,7 +47,6 @@ class kolab_storage
|
||||||
private static $with_tempsubs = true;
|
private static $with_tempsubs = true;
|
||||||
private static $subscriptions;
|
private static $subscriptions;
|
||||||
private static $ldapcache = array();
|
private static $ldapcache = array();
|
||||||
private static $typedata = array();
|
|
||||||
private static $ldap = array();
|
private static $ldap = array();
|
||||||
private static $states;
|
private static $states;
|
||||||
private static $config;
|
private static $config;
|
||||||
|
@ -869,7 +868,8 @@ class kolab_storage
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
// In some conditions we can skip LIST command (?)
|
// If we only want groupware folders and don't care about the subscription state,
|
||||||
|
// then the metadata will already contain all folder names and we can avoid the LIST below.
|
||||||
if (!$subscribed && $filter != 'mail' && $prefix == '*') {
|
if (!$subscribed && $filter != 'mail' && $prefix == '*') {
|
||||||
foreach ($folderdata as $folder => $type) {
|
foreach ($folderdata as $folder => $type) {
|
||||||
if (!preg_match($regexp, $type)) {
|
if (!preg_match($regexp, $type)) {
|
||||||
|
@ -1106,11 +1106,6 @@ class kolab_storage
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return cached result
|
|
||||||
if (is_array(self::$typedata[$prefix])) {
|
|
||||||
return self::$typedata[$prefix];
|
|
||||||
}
|
|
||||||
|
|
||||||
$type_keys = array(self::CTYPE_KEY, self::CTYPE_KEY_PRIVATE);
|
$type_keys = array(self::CTYPE_KEY, self::CTYPE_KEY_PRIVATE);
|
||||||
|
|
||||||
// fetch metadata from *some* folders only
|
// fetch metadata from *some* folders only
|
||||||
|
@ -1153,10 +1148,7 @@ class kolab_storage
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep list in memory
|
return array_map(array('kolab_storage', 'folder_select_metadata'), $folderdata);
|
||||||
self::$typedata[$prefix] = array_map(array('kolab_storage', 'folder_select_metadata'), $folderdata);
|
|
||||||
|
|
||||||
return self::$typedata[$prefix];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1185,13 +1177,6 @@ class kolab_storage
|
||||||
{
|
{
|
||||||
self::setup();
|
self::setup();
|
||||||
|
|
||||||
// return in-memory cached result
|
|
||||||
foreach (self::$typedata as $typedata) {
|
|
||||||
if (array_key_exists($folder, $typedata)) {
|
|
||||||
return $typedata[$folder];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$metadata = self::$imap->get_metadata($folder, array(self::CTYPE_KEY, self::CTYPE_KEY_PRIVATE));
|
$metadata = self::$imap->get_metadata($folder, array(self::CTYPE_KEY, self::CTYPE_KEY_PRIVATE));
|
||||||
|
|
||||||
if (!is_array($metadata)) {
|
if (!is_array($metadata)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue