From a341ed64ec3575f5186f75698c8ae275361522ea Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 26 Sep 2004 19:37:04 +0000 Subject: [PATCH] improvements in detection and reload --- ChangeLog | 3 +++ read_dump.php | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e39ecb66f..fc220c791 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - Changelog $Id$ $Source$ +2004-09-26 Marc Delisle + * read_dump.php: improvements in detection and reload + 2004-09-25 Marc Delisle * lang/norwegian: Update, thanks to Sven-Erik Andersen - sven-erik. * lang/indonesian: Update thanks to Rachim Tamsjadi - tamsy. diff --git a/read_dump.php b/read_dump.php index c9d1e14d9..f03dfb0a0 100644 --- a/read_dump.php +++ b/read_dump.php @@ -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; }