Remember result of OC_User::isLoggedIn, can be very expensive to check

This commit is contained in:
Bart Visscher 2012-06-19 17:54:19 +02:00
parent 089ae980c4
commit 4b6f6291c5
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}
/**