Clear Horde's folders cache on actions in Roundcube folder manager

This commit is contained in:
Aleksander Machniak (Kolab Systems) 2011-07-10 20:21:53 +02:00
parent a9ef9fcfaa
commit c8ad37c8c9

View file

@ -48,6 +48,8 @@ class kolab_folders extends rcube_plugin
$this->add_hook('folder_form', array($this, 'folder_form')); $this->add_hook('folder_form', array($this, 'folder_form'));
$this->add_hook('folder_update', array($this, 'folder_save')); $this->add_hook('folder_update', array($this, 'folder_save'));
$this->add_hook('folder_create', array($this, 'folder_save')); $this->add_hook('folder_create', array($this, 'folder_save'));
$this->add_hook('folder_delete', array($this, 'folder_save'));
$this->add_hook('folder_rename', array($this, 'folder_save'));
$this->add_hook('folders_list', array($this, 'folders_list')); $this->add_hook('folders_list', array($this, 'folders_list'));
} }
@ -238,6 +240,14 @@ class kolab_folders extends rcube_plugin
*/ */
function folder_save($args) function folder_save($args)
{ {
// Folder actions from folders list
if (empty($args['record'])) {
// Just clear Horde folders cache and return
$this->clear_folders_cache();
return $args;
}
// Folder create/update with form
$ctype = trim(get_input_value('_ctype', RCUBE_INPUT_POST)); $ctype = trim(get_input_value('_ctype', RCUBE_INPUT_POST));
$subtype = trim(get_input_value('_subtype', RCUBE_INPUT_POST)); $subtype = trim(get_input_value('_subtype', RCUBE_INPUT_POST));
$mbox = $args['record']['name']; $mbox = $args['record']['name'];
@ -304,6 +314,11 @@ class kolab_folders extends rcube_plugin
} }
} }
// Clear Horde folders cache
if ($result) {
$this->clear_folders_cache();
}
$args['record']['class'] = self::folder_class_name($ctype); $args['record']['class'] = self::folder_class_name($ctype);
$args['record']['subscribe'] = $subscribe; $args['record']['subscribe'] = $subscribe;
$args['result'] = $result; $args['result'] = $result;
@ -490,4 +505,12 @@ class kolab_folders extends rcube_plugin
return implode(' ', $class); return implode(' ', $class);
} }
/**
* Clear Horde's folder cache. See Kolab_List::singleton().
*/
private function clear_folders_cache()
{
unset($_SESSION['horde_session_objects']['kolab_folderlist']);
}
} }