From d134dea50897382021fb78661edaab483fdfff73 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Thu, 16 Mar 2017 21:59:47 +0100 Subject: [PATCH] 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 --- lib/private/User/Database.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index b1795d27e93..060953c3009 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -68,9 +68,6 @@ class Database extends Backend implements IUserBackend { /** @var EventDispatcher */ private $eventDispatcher; - /** @var \OCP\IDBConnection */ - private $connection; - /** * \OC\User\Database constructor. * @@ -79,7 +76,6 @@ class Database extends Backend implements IUserBackend { public function __construct($eventDispatcher = null) { $this->cache = new CappedMemoryCache(); $this->eventDispatcher = $eventDispatcher ? $eventDispatcher : \OC::$server->getEventDispatcher(); - $this->connection = \OC::$server->getDatabaseConnection(); } /** @@ -189,8 +185,8 @@ class Database extends Backend implements IUserBackend { $parameters = []; $searchLike = ''; if ($search !== '') { - $parameters[] = '%' . $this->connection->escapeLikeParameter($search) . '%'; - $parameters[] = '%' . $this->connection->escapeLikeParameter($search) . '%'; + $parameters[] = '%' . \OC::$server->getDatabaseConnection()->escapeLikeParameter($search) . '%'; + $parameters[] = '%' . \OC::$server->getDatabaseConnection()->escapeLikeParameter($search) . '%'; $searchLike = ' WHERE LOWER(`displayname`) LIKE LOWER(?) OR ' . 'LOWER(`uid`) LIKE LOWER(?)'; } @@ -279,7 +275,7 @@ class Database extends Backend implements IUserBackend { $parameters = []; $searchLike = ''; if ($search !== '') { - $parameters[] = '%' . $this->connection->escapeLikeParameter($search) . '%'; + $parameters[] = '%' . \OC::$server->getDatabaseConnection()->escapeLikeParameter($search) . '%'; $searchLike = ' WHERE LOWER(`uid`) LIKE LOWER(?)'; } -- 2.39.5