Make WordPress Core

Ticket #31869: 31869.2.diff

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

     
    19751975                                                $index_columns .= '('.$column_data['subpart'].')';
    19761976                                        }
    19771977                                }
     1978
     1979                                // The alternative index string doesn't care about subparts
     1980                                $alt_index_columns = preg_replace( '/\([^)]*\)/', '', $index_columns );
     1981                                $alt_index_string  = $index_string;
     1982
    19781983                                // Add the column list to the index create string.
    1979                                 $index_string .= ' ('.$index_columns.')';
     1984                                $index_string     .= ' (' . $index_columns . ')';
     1985                                $alt_index_string .= ' (' . $alt_index_columns . ')';
     1986
    19801987                                if (!(($aindex = array_search($index_string, $indices)) === false)) {
    19811988                                        unset($indices[$aindex]);
    19821989                                        // todo: Remove this?
    19831990                                        //echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
    19841991                                }
     1992                                if ( ! ( ( $aindex = array_search( $alt_index_string, $indices ) ) === false ) ) {
     1993                                        _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' );
     1994                                        unset( $indices[ $aindex ] );
     1995                                }
    19851996                                // todo: Remove this?
    19861997                                //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";
    19871998                        }