Don't call function in constructor

The constructor is iniitiated already very early in base.php, thus requiring this here will break the setup and some more. For now we probably have to live with a static function call here thus.

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Lukas Reschke 2017-03-16 21:59:47 +01:00
parent 085891a15d
commit d134dea508
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
1 changed files with 3 additions and 7 deletions

View File

@ -68,9 +68,6 @@ class Database extends Backend implements IUserBackend {
/** @var EventDispatcher */ /** @var EventDispatcher */
private $eventDispatcher; private $eventDispatcher;
/** @var \OCP\IDBConnection */
private $connection;
/** /**
* \OC\User\Database constructor. * \OC\User\Database constructor.
* *
@ -79,7 +76,6 @@ class Database extends Backend implements IUserBackend {
public function __construct($eventDispatcher = null) { public function __construct($eventDispatcher = null) {
$this->cache = new CappedMemoryCache(); $this->cache = new CappedMemoryCache();
$this->eventDispatcher = $eventDispatcher ? $eventDispatcher : \OC::$server->getEventDispatcher(); $this->eventDispatcher = $eventDispatcher ? $eventDispatcher : \OC::$server->getEventDispatcher();
$this->connection = \OC::$server->getDatabaseConnection();
} }
/** /**
@ -189,8 +185,8 @@ class Database extends Backend implements IUserBackend {
$parameters = []; $parameters = [];
$searchLike = ''; $searchLike = '';
if ($search !== '') { if ($search !== '') {
$parameters[] = '%' . $this->connection->escapeLikeParameter($search) . '%'; $parameters[] = '%' . \OC::$server->getDatabaseConnection()->escapeLikeParameter($search) . '%';
$parameters[] = '%' . $this->connection->escapeLikeParameter($search) . '%'; $parameters[] = '%' . \OC::$server->getDatabaseConnection()->escapeLikeParameter($search) . '%';
$searchLike = ' WHERE LOWER(`displayname`) LIKE LOWER(?) OR ' $searchLike = ' WHERE LOWER(`displayname`) LIKE LOWER(?) OR '
. 'LOWER(`uid`) LIKE LOWER(?)'; . 'LOWER(`uid`) LIKE LOWER(?)';
} }
@ -279,7 +275,7 @@ class Database extends Backend implements IUserBackend {
$parameters = []; $parameters = [];
$searchLike = ''; $searchLike = '';
if ($search !== '') { if ($search !== '') {
$parameters[] = '%' . $this->connection->escapeLikeParameter($search) . '%'; $parameters[] = '%' . \OC::$server->getDatabaseConnection()->escapeLikeParameter($search) . '%';
$searchLike = ' WHERE LOWER(`uid`) LIKE LOWER(?)'; $searchLike = ' WHERE LOWER(`uid`) LIKE LOWER(?)';
} }