Merge pull request #6995 from MrPetovan/bug/6937-fix-checkBackend

Fix check backend
This commit is contained in:
Philipp 2019-04-11 12:53:06 +02:00 committed by GitHub
commit 33ec318ca6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View file

@ -248,7 +248,6 @@ class App
$this->profiler = $profiler; $this->profiler = $profiler;
$this->logger = $logger; $this->logger = $logger;
$this->checkBackend($isBackend);
$this->checkFriendicaApp(); $this->checkFriendicaApp();
$this->profiler->reset(); $this->profiler->reset();
@ -318,6 +317,8 @@ class App
$this->module = 'home'; $this->module = 'home';
} }
$this->isBackend = $isBackend || $this->checkBackend($this->module);
// Detect mobile devices // Detect mobile devices
$mobile_detect = new MobileDetect(); $mobile_detect = new MobileDetect();
@ -623,10 +624,10 @@ class App
* This isn't a perfect solution. But we need this check very early. * This isn't a perfect solution. But we need this check very early.
* So we cannot wait until the modules are loaded. * So we cannot wait until the modules are loaded.
* *
* @param string $backend true, if the backend flag was set during App initialization * @param string $module
* * @return bool
*/ */
private function checkBackend($backend) { private function checkBackend($module) {
static $backends = [ static $backends = [
'_well_known', '_well_known',
'api', 'api',
@ -651,7 +652,7 @@ class App
]; ];
// Check if current module is in backend or backend flag is set // Check if current module is in backend or backend flag is set
$this->isBackend = (in_array($this->module, $backends) || $backend || $this->isBackend); return in_array($module, $backends);
} }
/** /**

View file

@ -31,7 +31,9 @@ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface
Session::$exists = true; Session::$exists = true;
return $data; return $data;
} }
Logger::log("no data for session $session_id", Logger::TRACE);
Logger::notice('no data for session', ['session_id' => $session_id, 'uri' => $_SERVER['REQUEST_URI']]);
return ''; return '';
} }

View file

@ -31,7 +31,8 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa
Session::$exists = true; Session::$exists = true;
return $session['data']; return $session['data'];
} }
Logger::log("no data for session $session_id", Logger::TRACE);
Logger::notice('no data for session', ['session_id' => $session_id, 'uri' => $_SERVER['REQUEST_URI']]);
return ''; return '';
} }