diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-06-19 17:54:19 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-06-21 20:14:53 +0200 |
commit | a7e427a3cc85aaff75bffaf79d4a39d1a037946e (patch) | |
tree | 0cf72d3a5bdab9d4c3572b4eb2776bf30510a9c9 /lib/user.php | |
parent | 8aa7ed39a55e71cf6c054d40235a2dee99ca1b8a (diff) | |
download | nextcloud-server-a7e427a3cc85aaff75bffaf79d4a39d1a037946e.tar.gz nextcloud-server-a7e427a3cc85aaff75bffaf79d4a39d1a037946e.zip |
Remember result of OC_User::isLoggedIn, can be very expensive to check
Diffstat (limited to 'lib/user.php')
-rw-r--r-- | lib/user.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/user.php b/lib/user.php index 37e6dcd1435..24435eab23c 100644 --- a/lib/user.php +++ b/lib/user.php @@ -240,13 +240,17 @@ class OC_User { * Checks if the user is logged in */ public static function isLoggedIn(){ + static $is_login_checked = null; + if (!is_null($is_login_checked)) { + return $is_login_checked; + } if( isset($_SESSION['user_id']) AND $_SESSION['user_id']) { OC_App::loadApps(array('authentication')); if (self::userExists($_SESSION['user_id']) ){ - return true; + return $is_login_checked = true; } } - return false; + return $is_login_checked = false; } /** |