Changeset 47785 for trunk/src/wp-admin/includes/upgrade.php
- Timestamp:
- 05/12/2020 06:30:03 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/includes/upgrade.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/upgrade.php
r47597 r47785 2347 2347 $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $table_name ) ); 2348 2348 2349 if ( $wpdb->get_var( $query ) == $table_name ) {2349 if ( $wpdb->get_var( $query ) === $table_name ) { 2350 2350 return true; 2351 2351 } … … 2355 2355 2356 2356 // We cannot directly tell that whether this succeeded! 2357 if ( $wpdb->get_var( $query ) == $table_name ) {2357 if ( $wpdb->get_var( $query ) === $table_name ) { 2358 2358 return true; 2359 2359 } 2360 2360 2361 return false; 2361 2362 } … … 2374 2375 function drop_index( $table, $index ) { 2375 2376 global $wpdb; 2377 2376 2378 $wpdb->hide_errors(); 2379 2377 2380 $wpdb->query( "ALTER TABLE `$table` DROP INDEX `$index`" ); 2381 2378 2382 // Now we need to take out all the extra ones we may have created. 2379 2383 for ( $i = 0; $i < 25; $i++ ) { 2380 2384 $wpdb->query( "ALTER TABLE `$table` DROP INDEX `{$index}_$i`" ); 2381 2385 } 2386 2382 2387 $wpdb->show_errors(); 2388 2383 2389 return true; 2384 2390 } … … 2397 2403 function add_clean_index( $table, $index ) { 2398 2404 global $wpdb; 2405 2399 2406 drop_index( $table, $index ); 2400 2407 $wpdb->query( "ALTER TABLE `$table` ADD INDEX ( `$index` )" ); 2408 2401 2409 return true; 2402 2410 } … … 2416 2424 function maybe_add_column( $table_name, $column_name, $create_ddl ) { 2417 2425 global $wpdb; 2426 2418 2427 foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) { 2419 if ( $column == $column_name ) {2428 if ( $column === $column_name ) { 2420 2429 return true; 2421 2430 } … … 2427 2436 // We cannot directly tell that whether this succeeded! 2428 2437 foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) { 2429 if ( $column == $column_name ) {2438 if ( $column === $column_name ) { 2430 2439 return true; 2431 2440 } 2432 2441 } 2442 2433 2443 return false; 2434 2444 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)