]> source.dussan.org Git - nextcloud-server.git/commitdiff
moved performance improvement from isLoggedIn() to userExists() to avoid webdav problems
authorBjoern Schiessle <schiessle@owncloud.com>
Thu, 5 Jul 2012 13:55:46 +0000 (15:55 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Thu, 5 Jul 2012 13:55:46 +0000 (15:55 +0200)
lib/user.php

index 23b88aa1d061281906920519b64d900b6e30b369..d02c1208a8de967841118a52167f2009db1c3e5d 100644 (file)
@@ -240,17 +240,13 @@ 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 $is_login_checked = true;
+                               return true;
                        }
                }
-               return $is_login_checked = false;
+               return false;
        }
 
        /**
@@ -349,13 +345,17 @@ class OC_User {
         * @return boolean
         */
        public static function userExists($uid){
+               static $user_exists_checked = null;\r
+               if (!is_null($user_exists_checked)) {\r
+                       return $user_exists_checked;\r
+               }
                foreach(self::$_usedBackends as $backend){
                        $result=$backend->userExists($uid);
                        if($result===true){
-                               return true;
+                               return $user_exists_checked = true;
                        }
                }
-               return false;
+               return $user_exists_checked = false;
        }
 
        /**