summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-01-11 12:37:54 +0100
committerGitHub <noreply@github.com>2017-01-11 12:37:54 +0100
commit005ce8aaf6d13b1364ce73e571f80cd91c8b2e91 (patch)
tree2b62717924fe91d5b3cde85be9cb8ad32d9149a8 /lib
parentc4e51fd0557728a18a689d1160e00a09dfc6e789 (diff)
parent7e06f051c9f48dcfc64ddd9c49124e3ee8b1e773 (diff)
downloadnextcloud-server-005ce8aaf6d13b1364ce73e571f80cd91c8b2e91.tar.gz
nextcloud-server-005ce8aaf6d13b1364ce73e571f80cd91c8b2e91.zip
Merge pull request #3007 from Loki3000/master
Remove non required db requests
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AllConfig.php11
-rw-r--r--lib/private/Group/Database.php5
-rw-r--r--lib/private/User/Database.php7
3 files changed, 19 insertions, 4 deletions
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php
index 4e13d70371b..a58aec4aeea 100644
--- a/lib/private/AllConfig.php
+++ b/lib/private/AllConfig.php
@@ -358,12 +358,17 @@ class AllConfig implements \OCP\IConfig {
* ]
*/
private function getUserValues($userId) {
- // TODO - FIXME
- $this->fixDIInit();
-
if (isset($this->userCache[$userId])) {
return $this->userCache[$userId];
}
+ if ($userId === null || $userId === '') {
+ $this->userCache[$userId]=array();
+ return $this->userCache[$userId];
+ }
+
+ // TODO - FIXME
+ $this->fixDIInit();
+
$data = array();
$query = 'SELECT `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?';
$result = $this->connection->executeQuery($query, array($userId));
diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php
index e4144fdbe20..8be24fc50de 100644
--- a/lib/private/Group/Database.php
+++ b/lib/private/Group/Database.php
@@ -202,6 +202,11 @@ class Database extends \OC\Group\Backend {
* if the user exists at all.
*/
public function getUserGroups( $uid ) {
+ //guests has empty or null $uid
+ if ($uid === null || $uid === '') {
+ return [];
+ }
+
$this->fixDI();
// No magic!
diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php
index 69826f49be3..a281572ad55 100644
--- a/lib/private/User/Database.php
+++ b/lib/private/User/Database.php
@@ -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 ($uid === null || $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));