Ticket #17998: 17998.diff
File 17998.diff, 1.9 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/upgrade.php
1459 1459 $cqueries = apply_filters( 'dbdelta_create_queries', $cqueries ); 1460 1460 $iqueries = apply_filters( 'dbdelta_insert_queries', $iqueries ); 1461 1461 1462 // Check to see which tables and fields exist1463 if ($tables = $wpdb->get_col('SHOW TABLES;')) {1464 // For every table in the database1465 1462 $global_tables = $wpdb->tables( 'global' ); 1466 foreach ( $tables as $table) {1463 foreach ( $cqueries as $table => $who_cares ) { 1467 1464 // Upgrade global tables only for the main site. Don't upgrade at all if DO_NOT_UPGRADE_GLOBAL_TABLES is defined. 1468 1465 if ( in_array( $table, $global_tables ) && ( !is_main_site() || defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) ) 1469 1466 continue; 1470 1467 1471 // If a table query exists for the database table... 1472 if ( array_key_exists(strtolower($table), $cqueries) ) { 1468 // Fetch the table column structure from the database 1469 $tablefields = $wpdb->get_results("DESCRIBE {$table};"); 1470 1471 if ( ! $tablefields ) 1472 continue; 1473 1473 1474 // Clear the field and index arrays 1474 1475 $cfields = $indices = array(); 1475 1476 // Get all of the field names in the query from between the parens … … 1508 1509 } 1509 1510 } 1510 1511 1511 // Fetch the table column structure from the database1512 $tablefields = $wpdb->get_results("DESCRIBE {$table};");1513 1514 1512 // For every field in the table 1515 1513 foreach ($tablefields as $tablefield) { 1516 1514 // If the table field exists in the field array... … … 1610 1608 // Remove the original table creation query from processing 1611 1609 unset($cqueries[strtolower($table)]); 1612 1610 unset($for_update[strtolower($table)]); 1613 } else {1614 // This table exists in the database, but not in the creation queries?1615 }1616 1611 } 1617 }1618 1612 1619 1613 $allqueries = array_merge($cqueries, $iqueries); 1620 1614 if ($execute) {