From: Florent Bruneau Date: Sat, 20 Mar 2010 15:57:16 +0000 (+0100) Subject: Should avoid the user object to be rebuild on each page. X-Git-Tag: core/1.1.0~35 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=324d1fa0624aa8d737a78bc94585088f89ce86ea;p=platal.git 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 --- 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; }