summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2012-04-20 11:52:43 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2012-04-20 11:52:43 +0000
commitc4e862009f1a009d7df8baab02a1ce33a2682300 (patch)
tree236d744dbcc5bb584802b6215ca337c4840de1f2
parentcc867db117e75358a928f35431e5d83b3e935afb (diff)
- Use user object instead of session, if possible, to get user ID when creating cache object
git-svn-id: https://svn.roundcube.net/trunk@6105 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--roundcubemail/program/include/rcube.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/roundcubemail/program/include/rcube.php b/roundcubemail/program/include/rcube.php
index 780f9b699..66715ed85 100644
--- a/roundcubemail/program/include/rcube.php
+++ b/roundcubemail/program/include/rcube.php
@@ -244,7 +244,8 @@ class rcube
public function get_cache($name, $type='db', $ttl=0, $packed=true)
{
if (!isset($this->caches[$name])) {
- $this->caches[$name] = new rcube_cache($type, $_SESSION['user_id'], $name, $ttl, $packed);
+ $userid = $this->get_user_id();
+ $this->caches[$name] = new rcube_cache($type, $userid, $name, $ttl, $packed);
}
return $this->caches[$name];
@@ -1171,6 +1172,9 @@ class rcube
if (is_object($this->user)) {
return $this->user->ID;
}
+ else if (isset($_SESSION['user_id'])) {
+ return $_SESSION['user_id'];
+ }
return null;
}