When `dbDelta()` is checking whether an index is defined in a `CREATE TABLE` statement, don't worry if MySQL has a subpart defined on an index, but the `CREATE TABLE` doesn't.
Fixes #31869. Built from https://develop.svn.wordpress.org/trunk@32108 git-svn-id: http://core.svn.wordpress.org/trunk@32087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
acef02f060
commit
0179958273
|
@ -1980,12 +1980,23 @@ function dbDelta( $queries = '', $execute = true ) {
|
|||
$index_columns .= '('.$column_data['subpart'].')';
|
||||
}
|
||||
}
|
||||
|
||||
// The alternative index string doesn't care about subparts
|
||||
$alt_index_columns = preg_replace( '/\([^)]*\)/', '', $index_columns );
|
||||
|
||||
// Add the column list to the index create string.
|
||||
$index_string .= ' ('.$index_columns.')';
|
||||
if (!(($aindex = array_search($index_string, $indices)) === false)) {
|
||||
unset($indices[$aindex]);
|
||||
// todo: Remove this?
|
||||
//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
|
||||
$index_strings = array(
|
||||
"$index_string ($index_columns)",
|
||||
"$index_string ($alt_index_columns)",
|
||||
);
|
||||
|
||||
foreach( $index_strings as $index_string ) {
|
||||
if ( ! ( ( $aindex = array_search( $index_string, $indices ) ) === false ) ) {
|
||||
unset( $indices[ $aindex ] );
|
||||
break;
|
||||
// todo: Remove this?
|
||||
//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
|
||||
}
|
||||
}
|
||||
// todo: Remove this?
|
||||
//else echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br /><b>Did not find index:</b>".$index_string."<br />".print_r($indices, true)."</pre>\n";
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-beta4-32107';
|
||||
$wp_version = '4.2-beta4-32108';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue