Make WordPress Core

Changeset 60106


Ignore:
Timestamp:
03/29/2025 11:58:07 AM (3 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use $wpdb::prepare() in wp-admin/maint/repair.php.

Follow-up to [11902], [12092], [13224], [13229].

Props aristath, poena, afercia, SergeyBiryukov.
See #63168.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/maint/repair.php

    r59027 r60106  
    109109    // Loop over the tables, checking and repairing as needed.
    110110    foreach ( $tables as $table ) {
    111         $check = $wpdb->get_row( "CHECK TABLE $table" );
     111        $check = $wpdb->get_row( $wpdb->prepare( 'CHECK TABLE %i', $table ) );
    112112
    113113        echo '<p>';
     
    119119            printf( __( 'The %1$s table is not okay. It is reporting the following error: %2$s. WordPress will attempt to repair this table&hellip;' ), "<code>$table</code>", "<code>$check->Msg_text</code>" );
    120120
    121             $repair = $wpdb->get_row( "REPAIR TABLE $table" );
     121            $repair = $wpdb->get_row( $wpdb->prepare( 'REPAIR TABLE %i', $table ) );
    122122
    123123            echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
     
    134134
    135135        if ( $okay && $optimize ) {
    136             $analyze = $wpdb->get_row( "ANALYZE TABLE $table" );
     136            $analyze = $wpdb->get_row( $wpdb->prepare( 'ANALYZE TABLE %i', $table ) );
    137137
    138138            echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
     
    141141                printf( __( 'The %s table is already optimized.' ), "<code>$table</code>" );
    142142            } else {
    143                 $optimize = $wpdb->get_row( "OPTIMIZE TABLE $table" );
     143                $optimize = $wpdb->get_row( $wpdb->prepare( 'OPTIMIZE TABLE %i', $table ) );
    144144
    145145                echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
Note: See TracChangeset for help on using the changeset viewer.