Added workaround for Horde's folders caching issue, related to shutdown function (#137)

This commit is contained in:
Aleksander Machniak (Kolab Systems) 2011-07-10 10:27:44 +02:00
parent 059b099fc0
commit a9ef9fcfaa

View file

@ -88,6 +88,13 @@ class rcube_kolab
); );
Auth::setCredential('password', $pwd); Auth::setCredential('password', $pwd);
self::$ready = true; self::$ready = true;
// Register shutdown function for storing folders cache in session
// This is already required, because Roundcube session handler
// saves data into DB before Horde's shutdown function is called
if (!empty($conf['kolab']['imap']['cache_folders'])) {
$rcmail->add_shutdown_function(array('rcube_kolab', 'save_folders_cache'));
}
} }
NLS::setCharset('UTF-8'); NLS::setCharset('UTF-8');
@ -168,6 +175,18 @@ class rcube_kolab
unset($_SESSION['__auth']); unset($_SESSION['__auth']);
} }
/**
* Save Horde's folders cache in session (workaround shoutdown function issue)
*/
public static function save_folders_cache()
{
require_once 'Horde/SessionObjects.php';
$kolab = Kolab_List::singleton();
$session = Horde_SessionObjects::singleton();
$session->overwrite('kolab_folderlist', $kolab, false);
}
/** /**
* Creates folder ID from folder name * Creates folder ID from folder name
* *