Changeset 19040
- Timestamp:
- 10/21/2011 10:35:33 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/upgrade.php
r18899 r19040 1460 1460 $iqueries = apply_filters( 'dbdelta_insert_queries', $iqueries ); 1461 1461 1462 // Check to see which tables and fields exist 1463 if ($tables = $wpdb->get_col('SHOW TABLES;')) { 1464 // For every table in the database 1465 $global_tables = $wpdb->tables( 'global' ); 1466 foreach ($tables as $table) { 1467 // Upgrade global tables only for the main site. Don't upgrade at all if DO_NOT_UPGRADE_GLOBAL_TABLES is defined. 1468 if ( in_array( $table, $global_tables ) && ( !is_main_site() || defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) ) 1469 continue; 1470 1471 // If a table query exists for the database table... 1472 if ( array_key_exists(strtolower($table), $cqueries) ) { 1462 $global_tables = $wpdb->tables( 'global' ); 1463 foreach ( $cqueries as $table => $qry ) { 1464 // Upgrade global tables only for the main site. Don't upgrade at all if DO_NOT_UPGRADE_GLOBAL_TABLES is defined. 1465 if ( in_array( $table, $global_tables ) && ( !is_main_site() || defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) ) 1466 continue; 1467 1468 // Fetch the table column structure from the database 1469 $wpdb->suppress_errors(); 1470 $tablefields = $wpdb->get_results("DESCRIBE {$table};"); 1471 $wpdb->suppress_errors( false ); 1472 1473 if ( ! $tablefields ) 1474 continue; 1475 1473 1476 // Clear the field and index arrays 1474 1477 $cfields = $indices = array(); 1475 1478 // Get all of the field names in the query from between the parens 1476 preg_match("|\((.*)\)|ms", $ cqueries[strtolower($table)], $match2);1479 preg_match("|\((.*)\)|ms", $qry, $match2); 1477 1480 $qryline = trim($match2[1]); 1478 1481 … … 1508 1511 } 1509 1512 } 1510 1511 // Fetch the table column structure from the database1512 $tablefields = $wpdb->get_results("DESCRIBE {$table};");1513 1513 1514 1514 // For every field in the table … … 1608 1608 } 1609 1609 1610 // Remove the original table creation query from processing 1611 unset($cqueries[strtolower($table)]); 1612 unset($for_update[strtolower($table)]); 1613 } else { 1614 // This table exists in the database, but not in the creation queries? 1615 } 1616 } 1610 // Remove the original table creation query from processing 1611 unset( $cqueries[ $table ], $for_update[ $table ] ); 1617 1612 } 1618 1613
Note: See TracChangeset
for help on using the changeset viewer.