]> source.dussan.org Git - nextcloud-server.git/commitdiff
remove non required db requests
authorLoki3000 <github@labcms.ru>
Tue, 10 Jan 2017 10:09:33 +0000 (13:09 +0300)
committerGitHub <noreply@github.com>
Tue, 10 Jan 2017 10:09:33 +0000 (13:09 +0300)
lib/private/User/Database.php

index 69826f49be30fd544ef559c115f24a1bd98970bd..dccdb790145a7328c9bbe4b87f8aa5b8f9d9d528 100644 (file)
@@ -75,7 +75,6 @@ class Database extends Backend implements IUserBackend {
         */
        public function __construct($eventDispatcher = null) {
                $this->cache = new CappedMemoryCache();
-               $this->cache[null] = false;
                $this->eventDispatcher = $eventDispatcher ? $eventDispatcher : \OC::$server->getEventDispatcher();
        }
 
@@ -239,6 +238,12 @@ class Database extends Backend implements IUserBackend {
         */
        private function loadUser($uid) {
                if (!isset($this->cache[$uid])) {
+                       //guests $uid could be NULL or ''
+                       if (empty($uid)) {
+                               $this->cache[$uid]=false;
+                               return true;
+                       }
+
                        $query = \OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)');
                        $result = $query->execute(array($uid));