Make WordPress Core

Ticket #49239: install-helper.php.patch

File install-helper.php.patch, 2.5 KB (added by pikamander2, 6 years ago)
  • install-helper.php

     
    5252        function maybe_create_table( $table_name, $create_ddl ) {
    5353                global $wpdb;
    5454                foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) {
    55                         if ( $table == $table_name ) {
     55                        if ( $table === $table_name ) {
    5656                                return true;
    5757                        }
    5858                }
     
    6161
    6262                // We cannot directly tell that whether this succeeded!
    6363                foreach ( $wpdb->get_col( 'SHOW TABLES', 0 ) as $table ) {
    64                         if ( $table == $table_name ) {
     64                        if ( $table === $table_name ) {
    6565                                return true;
    6666                        }
    6767                }
     
    8686                global $wpdb;
    8787                foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
    8888
    89                         if ( $column == $column_name ) {
     89                        if ( $column === $column_name ) {
    9090                                return true;
    9191                        }
    9292                }
     
    9696
    9797                // We cannot directly tell that whether this succeeded!
    9898                foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
    99                         if ( $column == $column_name ) {
     99                        if ( $column === $column_name ) {
    100100                                return true;
    101101                        }
    102102                }
     
    119119function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
    120120        global $wpdb;
    121121        foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
    122                 if ( $column == $column_name ) {
     122                if ( $column === $column_name ) {
    123123
    124124                        // Found it, so try to drop it.
    125125                        $wpdb->query( $drop_ddl );
     
    126126
    127127                        // We cannot directly tell that whether this succeeded!
    128128                        foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
    129                                 if ( $column == $column_name ) {
     129                                if ( $column === $column_name ) {
    130130                                        return false;
    131131                                }
    132132                        }
     
    172172
    173173        foreach ( $results as $row ) {
    174174
    175                 if ( $row->Field == $col_name ) {
     175                if ( $row->Field === $col_name ) {
    176176
    177177                        // Got our column, check the params.
    178                         if ( ( $col_type != null ) && ( $row->Type != $col_type ) ) {
     178                        if ( ( $col_type != null ) && ( $row->Type !== $col_type ) ) {
    179179                                ++$diffs;
    180180                        }
    181181                        if ( ( $is_null != null ) && ( $row->Null != $is_null ) ) {
    182182                                ++$diffs;
    183183                        }
    184                         if ( ( $key != null ) && ( $row->Key != $key ) ) {
     184                        if ( ( $key != null ) && ( $row->Key !== $key ) ) {
    185185                                ++$diffs;
    186186                        }
    187                         if ( ( $default != null ) && ( $row->Default != $default ) ) {
     187                        if ( ( $default !== null ) && ( $row->Default !== $default ) ) {
    188188                                ++$diffs;
    189189                        }
    190                         if ( ( $extra != null ) && ( $row->Extra != $extra ) ) {
     190                        if ( ( $extra !== null ) && ( $row->Extra !== $extra ) ) {
    191191                                ++$diffs;
    192192                        }
    193193                        if ( $diffs > 0 ) {