Changeset 60782
- Timestamp:
- 09/19/2025 11:58:02 AM (6 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-admin/includes/upgrade.php (modified) (1 diff)
-
tests/phpunit/tests/db/dbDelta.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/upgrade.php
r60725 r60782 2963 2963 foreach ( $queries as $qry ) { 2964 2964 if ( preg_match( '|CREATE TABLE ([^ ]*)|', $qry, $matches ) ) { 2965 $cqueries[ trim( $matches[1], '`' ) ] = $qry; 2966 $for_update[ $matches[1] ] = 'Created table ' . $matches[1]; 2965 $table_name = trim( $matches[1], '`' ); 2966 2967 $cqueries[ $table_name ] = $qry; 2968 $for_update[ $table_name ] = 'Created table ' . $matches[1]; 2967 2969 continue; 2968 2970 } -
trunk/tests/phpunit/tests/db/dbDelta.php
r57987 r60782 142 142 143 143 /** 144 * Test that it does nothingfor an existing table.144 * Test that no update is reported for an existing table. 145 145 */ 146 146 public function test_existing_table() { … … 157 157 KEY compound_key (id,column_1($this->max_index_length)) 158 158 ) 159 " 159 ", 160 false 161 ); 162 163 $this->assertSame( array(), $updates ); 164 } 165 166 /** 167 * Test that no update is reported for an existing table name in backticks. 168 * 169 * @ticket 63976 170 */ 171 public function test_existing_table_name_in_backticks() { 172 173 global $wpdb; 174 175 $updates = dbDelta( 176 " 177 CREATE TABLE `{$wpdb->prefix}dbdelta_test` ( 178 id bigint(20) NOT NULL AUTO_INCREMENT, 179 column_1 varchar(255) NOT NULL, 180 PRIMARY KEY (id), 181 KEY key_1 (column_1($this->max_index_length)), 182 KEY compound_key (id,column_1($this->max_index_length)) 183 ) 184 ", 185 false 160 186 ); 161 187
Note: See TracChangeset
for help on using the changeset viewer.