Make WordPress Core

Ticket #31869: 31869.3.diff

File 31869.3.diff, 1.5 KB (added by pento, 10 years ago)
  • src/wp-admin/includes/upgrade.php

     
    19801980                                                $index_columns .= '('.$column_data['subpart'].')';
    19811981                                        }
    19821982                                }
     1983
     1984                                // The alternative index string doesn't care about subparts
     1985                                $alt_index_columns = preg_replace( '/\([^)]*\)/', '', $index_columns );
     1986                                $alt_index_string  = $index_string;
     1987
    19831988                                // Add the column list to the index create string.
    1984                                 $index_string .= ' ('.$index_columns.')';
     1989                                $index_string     .= ' (' . $index_columns . ')';
     1990                                $alt_index_string .= ' (' . $alt_index_columns . ')';
     1991
    19851992                                if (!(($aindex = array_search($index_string, $indices)) === false)) {
    19861993                                        unset($indices[$aindex]);
    19871994                                        // todo: Remove this?
    19881995                                        //echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
    19891996                                }
     1997                                if ( ! ( ( $aindex = array_search( $alt_index_string, $indices ) ) === false ) ) {
     1998                                        _doing_it_wrong( __FUNCTION__, sprintf( __( 'You should be specifying an index length in the CREATE TABLE statement for the %s index.' ), "$table.$index_name" ), '4.2' );
     1999                                        unset( $indices[ $aindex ] );
     2000                                }
    19902001                                // todo: Remove this?
    19912002                                //else echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br /><b>Did not find index:</b>".$index_string."<br />".print_r($indices, true)."</pre>\n";
    19922003                        }