$return = &get_session("dbs");
if ($return === null) {
if ($flush) {
- restart_session();
ob_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;
}
include "./include/connect.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
+ session_cache_limiter(""); // to allow restarting session
session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later
}
if (DB != "" && $databases && !in_array(DB, $databases, true)) {
$databases = null;
}
+ stop_session();
if ($error) {
echo "<div class='error'>$error</div>\n";
}
}
}
+/** 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
* @param string
* @return mixed
$table_name = $adminer->tableName($table_status);
page_header(lang('Select') . ": $table_name", $error);
-session_write_close();
$set = null;
if (isset($rights["insert"])) {
}
}
$space = "(?:\\s|/\\*.*\\*/|(?:#|-- )[^\n]*\n|--\n)";
- if (!ini_bool("session.use_cookies")) {
- session_write_close();
- }
$delimiter = ";";
$offset = 0;
$empty = true;
if (preg_match("~^$space*(CREATE|DROP|ALTER)$space+(DATABASE|SCHEMA)\\b~isU", $q)) {
restart_session();
set_session("dbs", null); // clear cache
- session_write_close();
+ stop_session();
}
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";