summaryrefslogtreecommitdiffstats
path: root/lib/private/Server.php
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@owncloud.com>2016-04-27 12:01:13 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2016-05-11 13:36:46 +0200
commit7aa16e1559e8ef1121ac2529090a6881b4d919d5 (patch)
tree3967b0038d51acc71c7e41b44fd1008c004f7fa5 /lib/private/Server.php
parent18704a9fc879b13322d6ddc6f8e0ef331415a5c3 (diff)
downloadnextcloud-server-7aa16e1559e8ef1121ac2529090a6881b4d919d5.tar.gz
nextcloud-server-7aa16e1559e8ef1121ac2529090a6881b4d919d5.zip
fix setup
Diffstat (limited to 'lib/private/Server.php')
-rw-r--r--lib/private/Server.php17
1 files changed, 12 insertions, 5 deletions
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));