WordPress.org

Make WordPress Core

Ticket #19748: 19748.patch

File 19748.patch, 1.6 KB (added by SergeyBiryukov, 6 years ago)
  • wp-admin/includes/upgrade.php

     
    14861486        $for_update = array();
    14871487
    14881488        // Create a tablename index for an array ($cqueries) of queries
    1489         foreach($queries as $qry) {
    1490                 if (preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
    1491                         $cqueries[trim( strtolower($matches[1]), '`' )] = $qry;
    1492                         $for_update[$matches[1]] = 'Created table '.$matches[1];
    1493                 } else if (preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) {
     1489        foreach( $queries as $qry ) {
     1490                if ( preg_match( "|CREATE TABLE ([^ ]*)|", $qry, $matches ) ) {
     1491                        $cqueries[ trim( $matches[1], '`' ) ] = $qry;
     1492                        $for_update[ $matches[1] ] = 'Created table ' . $matches[1];
     1493                } else if ( preg_match( "|CREATE DATABASE ([^ ]*)|", $qry, $matches ) ) {
    14941494                        array_unshift($cqueries, $qry);
    1495                 } else if (preg_match("|INSERT INTO ([^ ]*)|", $qry, $matches)) {
     1495                } else if ( preg_match( "|INSERT INTO ([^ ]*)|", $qry, $matches ) ) {
    14961496                        $iqueries[] = $qry;
    1497                 } else if (preg_match("|UPDATE ([^ ]*)|", $qry, $matches)) {
     1497                } else if ( preg_match( "|UPDATE ([^ ]*)|", $qry, $matches ) ) {
    14981498                        $iqueries[] = $qry;
    14991499                } else {
    15001500                        // Unrecognized query type
     
    15261526                // Separate field lines into an array
    15271527                $flds = explode("\n", $qryline);
    15281528
    1529                 //echo "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>";
    1530 
    15311529                // For every field line specified in the query
    15321530                foreach ($flds as $fld) {
    15331531                        // Extract the field name