Make WordPress Core

Ticket #31869: 31869.diff

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

     
    19631963                                if ($index_name != 'PRIMARY') {
    19641964                                        $index_string .= $index_name;
    19651965                                }
    1966                                 $index_columns = '';
     1966                                $alt_index_columns = $index_columns = '';
    19671967
    19681968                                // For each column in the index.
    19691969                                foreach ($index_data['columns'] as $column_data) {
    1970                                         if ($index_columns != '') $index_columns .= ',';
     1970                                        if ( '' != $index_columns ) {
     1971                                                $index_columns     .= ',';
     1972                                                $alt_index_columns .= ',';
     1973                                        }
    19711974
    19721975                                        // Add the field to the column list string.
    1973                                         $index_columns .= $column_data['fieldname'];
     1976                                        $index_columns     .= $column_data['fieldname'];
     1977                                        $alt_index_columns .= $column_data['fieldname'];
    19741978                                        if ($column_data['subpart'] != '') {
     1979                                                // We don't add the subpart to the alternative index string
    19751980                                                $index_columns .= '('.$column_data['subpart'].')';
    19761981                                        }
    19771982                                }
     1983
     1984                                $alt_index_string = $index_string;
     1985
    19781986                                // Add the column list to the index create string.
    1979                                 $index_string .= ' ('.$index_columns.')';
     1987                                $index_string     .= ' (' . $index_columns . ')';
     1988                                $alt_index_string .= ' (' . $alt_index_columns . ')';
    19801989                                if (!(($aindex = array_search($index_string, $indices)) === false)) {
    19811990                                        unset($indices[$aindex]);
    19821991                                        // todo: Remove this?
    19831992                                        //echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
    19841993                                }
     1994                                if ( ! ( ( $aindex = array_search( $alt_index_string, $indices ) ) === false ) ) {
     1995                                        _doing_it_wrong( __FUNCTION__, sprintf( __( 'You should be specifying an index length in your CREATE TABLE statement for the %s index.' ), "$table.$index_name" ), '4.2' );
     1996                                        unset( $indices[ $aindex ] );
     1997                                }
    19851998                                // todo: Remove this?
    19861999                                //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";
    19872000                        }