From: Lukas Reschke Date: Thu, 16 Mar 2017 20:59:47 +0000 (+0100) Subject: Don't call function in constructor X-Git-Tag: v12.0.0beta1~408^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d134dea50897382021fb78661edaab483fdfff73;p=nextcloud-server.git 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 --- 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(?)'; }