Merge pull request #3007 from Loki3000/master

Remove non required db requests
This commit is contained in:
Roeland Jago Douma 2017-01-11 12:37:54 +01:00 committed by GitHub
commit 005ce8aaf6
3 changed files with 19 additions and 4 deletions

View File

@ -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));

View File

@ -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!

View 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 ($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));