improvements in detection and reload

This commit is contained in:
Marc Delisle
2004-09-26 19:37:04 +00:00
parent 9093fd89ee
commit a341ed64ec
2 changed files with 6 additions and 3 deletions

View File

@@ -5,6 +5,9 @@ phpMyAdmin - Changelog
$Id$
$Source$
2004-09-26 Marc Delisle <lem9@users.sourceforge.net>
* read_dump.php: improvements in detection and reload
2004-09-25 Marc Delisle <lem9@users.sourceforge.net>
* lang/norwegian: Update, thanks to Sven-Erik Andersen - sven-erik.
* lang/indonesian: Update thanks to Rachim Tamsjadi - tamsy.

View File

@@ -253,7 +253,7 @@ if ($sql_query != '') {
if ($pieces_count == 1 && !empty($pieces[0]['query'])) {
$sql_query = $pieces[0]['query'];
// .*? below is non greedy expansion, just in case somebody wants to understand it...
if (preg_match('@^((-- |#)[^\n]*\n|/\*.*?\*/)*(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@i', $sql_query)) {
if (preg_match('@^((-- |#)[^\n]*\n|/\*.*?\*/)*(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@im', $sql_query)) {
$reload = 1;
}
require('./sql.php');
@@ -275,6 +275,7 @@ if ($sql_query != '') {
$a_sql_query = $pieces[$i]['query'];
// .*? below is non greedy expansion, just in case somebody wants to understand it...
// looks ok here without using PCRE_MULTILINE
if ($i == $count - 1 && preg_match('@^((-- |#)[^\n]*\n|/\*.*?\*/)*(SELECT|SHOW)@i', $a_sql_query)) {
$complete_query = $sql_query;
$display_query = $sql_query;
@@ -322,13 +323,12 @@ if ($sql_query != '') {
// .*? below is non greedy expansion, just in case somebody wants to understand it...
if ($result != FALSE && preg_match('@^((-- |#)^[\n]*|/\*.*?\*/)*USE[[:space:]]*([^[:space]+)@i', $a_sql_query, $match)) {
$db = trim($match[0]);
$reload = 1;
}
// .*? below is non greedy expansion, just in case somebody wants to understand it...
// must check $a_sql_query and use PCRE_MULTILINE
//if (!isset($reload) && preg_match('@^((-- |#)[^\n]*\n|/\*.*?\*/)*(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@i', $sql_query)) {
if (!isset($reload) && preg_match('@^((-- |#)[^\n]*\n|/\*.*?\*/)*(DROP|CREATE)[[:space:]]+(IF EXISTS[[:space:]]+)?(TABLE|DATABASE)[[:space:]]+(.+)@im', $a_sql_query)) {
$reload = 1;
}