Clear cache by CREATE DATABASE (bug #2952276)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1318 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
899e4342fb
commit
98197cb42d
|
@ -27,9 +27,7 @@ if (!$error && $_POST) {
|
||||||
}
|
}
|
||||||
$space = "(\\s|/\\*.*\\*/|(#|-- )[^\n]*\n|--\n)";
|
$space = "(\\s|/\\*.*\\*/|(#|-- )[^\n]*\n|--\n)";
|
||||||
$alter_database = "(CREATE|DROP)$space+(DATABASE|SCHEMA)\\b~isU";
|
$alter_database = "(CREATE|DROP)$space+(DATABASE|SCHEMA)\\b~isU";
|
||||||
$databases = &$_SESSION["databases"][$_GET["server"]];
|
if (!ini_get("session.use_cookies")) {
|
||||||
if (!ini_get("session.use_cookies") || (isset($databases) && !preg_match("~\\b$alter_database", $query))) { // quick check - may be inside string
|
|
||||||
//! false positive with $fp and disabled ini_set() and enabled session.use_cookies
|
|
||||||
session_write_close();
|
session_write_close();
|
||||||
}
|
}
|
||||||
$delimiter = ";";
|
$delimiter = ";";
|
||||||
|
@ -87,7 +85,9 @@ if (!$error && $_POST) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (preg_match("~^$space*$alter_database", $query)) {
|
if (preg_match("~^$space*$alter_database", $query)) {
|
||||||
$databases = null; // clear cache
|
restart_session();
|
||||||
|
$_SESSION["databases"][$_GET["server"]] = null; // clear cache
|
||||||
|
session_write_close();
|
||||||
}
|
}
|
||||||
echo "<p class='message' title='" . h($connection->info) . "'>" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "\n";
|
echo "<p class='message' title='" . h($connection->info) . "'>" . lang('Query executed OK, %d row(s) affected.', $connection->affected_rows) . "\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue