From 324d1fa0624aa8d737a78bc94585088f89ce86ea Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sat, 20 Mar 2010 16:57:16 +0100 Subject: [PATCH] Should avoid the user object to be rebuild on each page. Warning: not sure at all this is a good idea: you have to invalidate the object stored in the session (if any) if you want to reload a parameter (like the display name). Signed-off-by: Florent Bruneau --- classes/s.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/s.php b/classes/s.php index 0ee548e..346f3be 100644 --- a/classes/s.php +++ b/classes/s.php @@ -119,7 +119,11 @@ class S public static function &user() { if (self::$user == null && class_exists('User')) { - self::$user = User::getSilentWithValues(S::i('uid'), $_SESSION); + if (S::has('user') && S::v('user') instanceof User) { + self::$user = S::v('user'); + } else { + self::$user = User::getSilentWithValues(S::i('uid'), $_SESSION); + } } return self::$user; } -- 2.1.4