Make WordPress Core

Ticket #8768: patch.txt

File patch.txt, 1.2 KB (added by binnyva, 16 years ago)

Patch for wp-admin/includes/upgrade.php

Line 
1Index: wp-admin/includes/upgrade.php
2===================================================================
3--- wp-admin/includes/upgrade.php       (revision 10284)
4+++ wp-admin/includes/upgrade.php       (working copy)
5@@ -1119,8 +1119,9 @@
6        // Create a tablename index for an array ($cqueries) of queries
7        foreach($queries as $qry) {
8                if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
9-                       $cqueries[strtolower($matches[1])] = $qry;
10-                       $for_update[$matches[1]] = 'Created table '.$matches[1];
11+                       $table_name = str_replace('`','', $matches[1]); //Make sure it work if the table names have the ` style quoting
12+                       $cqueries[strtolower($table_name)] = $qry;
13+                       $for_update[$table_name] = 'Created table '.$table_name;
14                }
15                else if(preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) {
16                        array_unshift($cqueries, $qry);
17@@ -1158,8 +1159,9 @@
18                                foreach($flds as $fld) {
19                                        // Extract the field name
20                                        preg_match("|^([^ ]*)|", trim($fld), $fvals);
21-                                       $fieldname = $fvals[1];
22-
23+                                       $fieldname = str_replace('`','', $fvals[1]);
24+                                       $fld = preg_replace("/`([^` ]+)`/", "$1", $fld);
25+                                       
26                                        // Verify the found field name
27                                        $validfield = true;
28                                        switch(strtolower($fieldname))