Only use the user session if ownCloud is already installed

When installing ownCloud with autotest and MySQL some log entries may be created which will invoke the logging class. IUserSession has a dependency on the database which will make the installation fail => 💣
This commit is contained in:
Lukas Reschke 2016-03-22 17:34:20 +01:00
parent 177ad39854
commit 43516ebef9
1 changed files with 5 additions and 1 deletions

View File

@ -90,7 +90,11 @@ class OC_Log_Owncloud {
$time = $time->format($format);
$url = ($request->getRequestUri() !== '') ? $request->getRequestUri() : '--';
$method = is_string($request->getMethod()) ? $request->getMethod() : '--';
$userObj = \OC::$server->getUserSession()->getUser();
if(\OC::$server->getConfig()->getSystemValue('installed', false)) {
$userObj = \OC::$server->getUserSession()->getUser();
} else {
$userObj = null;
}
$user = !is_null($userObj) ? $userObj->getUID() : '--';
$entry = compact(
'reqId',