1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Fixes #3373 Improved db_verify table parsing for languages other than English.

This commit is contained in:
Cameron
2018-08-17 13:55:34 -07:00
parent 1754887672
commit 744a71f785

View File

@@ -823,12 +823,12 @@ class db_verify
// $regex = "/CREATE TABLE `?([\w]*)`?\s*?\(([\s\w\+\-_\(\),'\. `]*)\)\s*(ENGINE|TYPE)\s*?=\s?([\w]*)[\w =]*;/i";
$regex = "/CREATE TABLE (?:IF NOT EXISTS )?`?([\w]*)`?\s*?\(([\s\w\+\-_\(\),:'\. `]*)\)\s*(ENGINE|TYPE)\s*?=\s?([\w]*)[\w =]*;/i";
$table = preg_match_all($regex,$sql_data,$match);
// also support non-alphanumeric chars.
$regex = "/CREATE TABLE (?:IF NOT EXISTS )?`?([\w]*)`?\s*?\(([^;]*)\)\s*(ENGINE|TYPE)\s*?=\s?([\w]*)[\w =]*;/i";
preg_match_all($regex,$sql_data,$match);
$tables = array();
foreach($match[1] as $c=>$k)
@@ -843,7 +843,19 @@ class db_verify
$ret['tables'] = $tables;
$ret['data'] = $match[2];
$data = array();
if(!empty($match[2])) // clean/trim data.
{
foreach($match[2] as $dat)
{
$dat = str_replace("\t", '', $dat); // remove tab chars.
$data[] = trim($dat);
}
}
$ret['data'] = $data;
$ret['engine'] = $match[4];
if(empty($ret['tables']))