Improve session management
This commit is contained in:
parent
c9da3ccb51
commit
5e0038b62d
|
@ -271,11 +271,13 @@ if (!defined("DRIVER")) {
|
||||||
$return = &get_session("dbs");
|
$return = &get_session("dbs");
|
||||||
if ($return === null) {
|
if ($return === null) {
|
||||||
if ($flush) {
|
if ($flush) {
|
||||||
restart_session();
|
|
||||||
ob_flush();
|
ob_flush();
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
$return = get_vals($connection->server_info >= 5 ? "SELECT SCHEMA_NAME FROM information_schema.SCHEMATA" : "SHOW DATABASES"); // SHOW DATABASES can be disabled by skip_show_database
|
$databases = get_vals($connection->server_info >= 5 ? "SELECT SCHEMA_NAME FROM information_schema.SCHEMATA" : "SHOW DATABASES"); // SHOW DATABASES can be disabled by skip_show_database
|
||||||
|
restart_session();
|
||||||
|
$return = $databases;
|
||||||
|
stop_session();
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,8 +76,8 @@ include "../adminer/include/auth.inc.php";
|
||||||
include "./include/connect.inc.php";
|
include "./include/connect.inc.php";
|
||||||
include "./include/editing.inc.php";
|
include "./include/editing.inc.php";
|
||||||
|
|
||||||
session_cache_limiter(""); // to allow restarting session
|
|
||||||
if (!ini_bool("session.use_cookies") || @ini_set("session.use_cookies", false) !== false) { // @ - may be disabled
|
if (!ini_bool("session.use_cookies") || @ini_set("session.use_cookies", false) !== false) { // @ - may be disabled
|
||||||
|
session_cache_limiter(""); // to allow restarting session
|
||||||
session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later
|
session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ document.body.className = document.body.className.replace(/ nojs/, ' js');
|
||||||
if (DB != "" && $databases && !in_array(DB, $databases, true)) {
|
if (DB != "" && $databases && !in_array(DB, $databases, true)) {
|
||||||
$databases = null;
|
$databases = null;
|
||||||
}
|
}
|
||||||
|
stop_session();
|
||||||
if ($error) {
|
if ($error) {
|
||||||
echo "<div class='error'>$error</div>\n";
|
echo "<div class='error'>$error</div>\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,6 +396,15 @@ function restart_session() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Stop session if it would be possible to restart it later
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
function stop_session() {
|
||||||
|
if (!ini_bool("session.use_cookies")) {
|
||||||
|
session_write_close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Get session variable for current server
|
/** Get session variable for current server
|
||||||
* @param string
|
* @param string
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
|
|
@ -189,7 +189,6 @@ if ($_POST && !$error) {
|
||||||
|
|
||||||
$table_name = $adminer->tableName($table_status);
|
$table_name = $adminer->tableName($table_status);
|
||||||
page_header(lang('Select') . ": $table_name", $error);
|
page_header(lang('Select') . ": $table_name", $error);
|
||||||
session_write_close();
|
|
||||||
|
|
||||||
$set = null;
|
$set = null;
|
||||||
if (isset($rights["insert"])) {
|
if (isset($rights["insert"])) {
|
||||||
|
|
|
@ -39,9 +39,6 @@ if (!$error && $_POST) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$space = "(?:\\s|/\\*.*\\*/|(?:#|-- )[^\n]*\n|--\n)";
|
$space = "(?:\\s|/\\*.*\\*/|(?:#|-- )[^\n]*\n|--\n)";
|
||||||
if (!ini_bool("session.use_cookies")) {
|
|
||||||
session_write_close();
|
|
||||||
}
|
|
||||||
$delimiter = ";";
|
$delimiter = ";";
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
$empty = true;
|
$empty = true;
|
||||||
|
@ -136,7 +133,7 @@ if (!$error && $_POST) {
|
||||||
if (preg_match("~^$space*(CREATE|DROP|ALTER)$space+(DATABASE|SCHEMA)\\b~isU", $q)) {
|
if (preg_match("~^$space*(CREATE|DROP|ALTER)$space+(DATABASE|SCHEMA)\\b~isU", $q)) {
|
||||||
restart_session();
|
restart_session();
|
||||||
set_session("dbs", null); // clear cache
|
set_session("dbs", null); // clear cache
|
||||||
session_write_close();
|
stop_session();
|
||||||
}
|
}
|
||||||
if (!$_POST["only_errors"]) {
|
if (!$_POST["only_errors"]) {
|
||||||
echo "<p class='message' title='" . h($connection->info) . "'>" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "$time\n";
|
echo "<p class='message' title='" . h($connection->info) . "'>" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "$time\n";
|
||||||
|
|
Loading…
Reference in a new issue