From 0319cc9d234e107109d988f36f2361b25f9f0777 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 6 Oct 2020 23:19:45 +0200 Subject: Minz allow parallel sessions (#3096) * Minz allow parallel sessions #fix https://github.com/FreshRSS/FreshRSS/issues/3093 * Array optimisation * Array optimisation missing * Reduce direct access to $_SESSION except in install process * Fix session start headers warning * Use cookie only the first time the session is started: `PHP Warning: session_start(): Cannot start session when headers already sent in /var/www/FreshRSS/lib/Minz/Session.php on line 39` * New concept of volatile session for API calls Optimisation: do not use cookies or local storage at all for API calls without a Web session Fix warning: ``` PHP Warning: session_destroy(): Trying to destroy uninitialized session in Unknown on line 0 ``` * Only call Minz_Session::init once in our index It was called twice (once indirectly via FreshRSS->init()) * Whitespace * Mutex for notifications Implement mutex for notifications https://github.com/FreshRSS/FreshRSS/pull/3208#discussion_r499509809 * Typo * Install script is not ready for using Minz_Session --- cli/_cli.php | 1 + cli/do-install.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'cli') diff --git a/cli/_cli.php b/cli/_cli.php index 4e1188428..68a0f8731 100644 --- a/cli/_cli.php +++ b/cli/_cli.php @@ -10,6 +10,7 @@ require(__DIR__ . '/../constants.php'); require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader require(LIB_PATH . '/lib_install.php'); +Minz_Session::init('FreshRSS', true); Minz_Configuration::register('system', DATA_PATH . '/config.php', FRESHRSS_PATH . '/config.default.php'); diff --git a/cli/do-install.php b/cli/do-install.php index 6535cc2e6..3fa9cd63e 100755 --- a/cli/do-install.php +++ b/cli/do-install.php @@ -93,10 +93,14 @@ Minz_Session::_param('currentUser', '_'); //Default user $ok = false; try { - $ok = initDb(); + $error = initDb(); + if ($error != '') { + $_SESSION['bd_error'] = $error; + } else { + $ok = true; + } } catch (Exception $ex) { $_SESSION['bd_error'] = $ex->getMessage(); - $ok = false; } if (!$ok) { -- cgit v1.2.3