From 7aa16e1559e8ef1121ac2529090a6881b4d919d5 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 27 Apr 2016 12:01:13 +0200 Subject: fix setup --- lib/private/Server.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'lib/private/Server.php') diff --git a/lib/private/Server.php b/lib/private/Server.php index 8af2f02479c..b17c1a384dc 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -223,11 +223,18 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService('UserSession', function (Server $c) { $manager = $c->getUserManager(); $session = new \OC\Session\Memory(''); - $defaultTokenProvider = $c->query('OC\Authentication\Token\DefaultTokenProvider'); - $tokenProviders = [ - $defaultTokenProvider, - ]; - + // Token providers might require a working database. This code + // might however be called when ownCloud is not yet setup. + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { + $defaultTokenProvider = $c->query('OC\Authentication\Token\DefaultTokenProvider'); + $tokenProviders = [ + $defaultTokenProvider, + ]; + } else { + $defaultTokenProvider = null; + $tokenProviders = []; + } + $userSession = new \OC\User\Session($manager, $session, $defaultTokenProvider, $tokenProviders); $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); -- cgit v1.2.3