Changeset 38591
- Timestamp:
- 09/12/2016 05:08:17 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/upgrade.php
r38109 r38591 2284 2284 2285 2285 // Escape the index name with backticks. An index for a primary key has no name. 2286 $index_name = ( 'PRIMARY KEY' === $index_type ) ? '' : '`' . $index_matches['index_name']. '`';2286 $index_name = ( 'PRIMARY KEY' === $index_type ) ? '' : '`' . strtolower( $index_matches['index_name'] ) . '`'; 2287 2287 2288 2288 // Parse the columns. Multiple columns are separated by a comma. … … 2408 2408 2409 2409 // Add the index to the index data array. 2410 $keyname = $tableindex->Key_name;2410 $keyname = strtolower( $tableindex->Key_name ); 2411 2411 $index_ary[$keyname]['columns'][] = array('fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part); 2412 2412 $index_ary[$keyname]['unique'] = ($tableindex->Non_unique == 0)?true:false; … … 2419 2419 // Build a create string to compare to the query. 2420 2420 $index_string = ''; 2421 if ($index_name == ' PRIMARY') {2421 if ($index_name == 'primary') { 2422 2422 $index_string .= 'PRIMARY '; 2423 2423 } elseif ( $index_data['unique'] ) { … … 2431 2431 } 2432 2432 $index_string .= 'KEY '; 2433 if ( ' PRIMARY' !== $index_name ) {2433 if ( 'primary' !== $index_name ) { 2434 2434 $index_string .= '`' . $index_name . '`'; 2435 2435 } -
trunk/tests/phpunit/tests/dbdelta.php
r38044 r38591 804 804 805 805 /** 806 * @ticket 34874 807 */ 808 function test_key_names_are_not_case_sensitive_and_do_not_recreate_indices() { 809 global $wpdb; 810 811 $updates = dbDelta( 812 " 813 CREATE TABLE {$wpdb->prefix}dbdelta_test ( 814 id bigint(20) NOT NULL AUTO_INCREMENT, 815 column_1 varchar(255) NOT NULL, 816 column_2 text, 817 column_3 blob, 818 PRIMARY KEY (id), 819 KEY KEY_1 (column_1), 820 KEY compOUND_key (id,column_1), 821 FULLTEXT KEY FULLtext_kEY (column_1) 822 ) ENGINE=MyISAM 823 ", false ); 824 825 $this->assertEmpty( $updates ); 826 } 827 828 /** 806 829 * @ticket 31679 807 830 */
Note: See TracChangeset
for help on using the changeset viewer.