Make WordPress Core

Ticket #41335: 41335.diff

File 41335.diff, 1.3 KB (added by sathyapulse, 18 months ago)
  • src/wp-admin/includes/upgrade.php

    diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php
    index 802269e047..a1dd97ce23 100644
    a b function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N 
    27362736
    27372737        // Create a tablename index for an array ($cqueries) of queries.
    27382738        foreach ( $queries as $qry ) {
    2739                 if ( preg_match( '|CREATE TABLE ([^ ]*)|', $qry, $matches ) ) {
     2739                if ( preg_match( '/CREATE TABLE IF NOT EXISTS ([^ ]*)|CREATE TABLE ([^ ]*)/', $qry, $matches ) ) {
    27402740                        $cqueries[ trim( $matches[1], '`' ) ] = $qry;
    27412741                        $for_update[ $matches[1] ]            = 'Created table ' . $matches[1];
    2742                 } elseif ( preg_match( '|CREATE DATABASE ([^ ]*)|', $qry, $matches ) ) {
     2742                } elseif ( preg_match( '/CREATE DATABASE IF NOT EXISTS ([^ ]*)|CREATE DATABASE ([^ ]*)/', $qry, $matches ) ) {
    27432743                        array_unshift( $cqueries, $qry );
    2744                 } elseif ( preg_match( '|INSERT INTO ([^ ]*)|', $qry, $matches ) ) {
     2744                } elseif ( preg_match( '/INSERT INTO ([^ ]*)/', $qry, $matches ) ) {
    27452745                        $iqueries[] = $qry;
    2746                 } elseif ( preg_match( '|UPDATE ([^ ]*)|', $qry, $matches ) ) {
     2746                } elseif ( preg_match( '/UPDATE ([^ ]*)/', $qry, $matches ) ) {
    27472747                        $iqueries[] = $qry;
    27482748                } else {
    27492749                        // Unrecognized query type.