Centralize stopping session

This commit is contained in:
Jakub Vrana 2018-02-20 23:14:36 +01:00
parent 846435aef8
commit 3f4f3454f8
2 changed files with 6 additions and 7 deletions

View file

@ -158,9 +158,7 @@ if (isset($_GET["username"]) && !class_exists("Min_DB")) {
exit; exit;
} }
if (!ini_bool("session.use_cookies") || @ini_set("session.use_cookies", false) !== false) { // @ - may be disabled stop_session(true);
session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later
}
if (isset($_GET["username"])) { if (isset($_GET["username"])) {
list($host, $port) = explode(":", SERVER, 2); list($host, $port) = explode(":", SERVER, 2);

View file

@ -564,12 +564,13 @@ function restart_session() {
} }
} }
/** Stop session if it would be possible to restart it later /** Stop session if possible
* @param bool
* @return null * @return null
*/ */
function stop_session() { function stop_session($force = false) {
if (!ini_bool("session.use_cookies")) { if (!ini_bool("session.use_cookies") || ($force && @ini_set("session.use_cookies", false) !== false)) { // @ - may be disabled
session_write_close(); session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later
} }
} }