Handle backticks in dbDelta. Props AaronCampbell. fixes #8014
git-svn-id: http://svn.automattic.com/wordpress/trunk@10948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ab49d00bc4
commit
4e62823c7a
|
@ -1185,7 +1185,7 @@ function dbDelta($queries, $execute = true) {
|
|||
// Create a tablename index for an array ($cqueries) of queries
|
||||
foreach($queries as $qry) {
|
||||
if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
|
||||
$cqueries[strtolower($matches[1])] = $qry;
|
||||
$cqueries[trim( strtolower($matches[1]), '`' )] = $qry;
|
||||
$for_update[$matches[1]] = 'Created table '.$matches[1];
|
||||
}
|
||||
else if(preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) {
|
||||
|
@ -1224,7 +1224,7 @@ function dbDelta($queries, $execute = true) {
|
|||
foreach($flds as $fld) {
|
||||
// Extract the field name
|
||||
preg_match("|^([^ ]*)|", trim($fld), $fvals);
|
||||
$fieldname = $fvals[1];
|
||||
$fieldname = trim( $fvals[1], '`' );
|
||||
|
||||
// Verify the found field name
|
||||
$validfield = true;
|
||||
|
|
Loading…
Reference in New Issue