Skip to content

Commit 979cd7f

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@60106 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 6d0f185 commit 979cd7f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/wp-admin/maint/repair.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108

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>';
114114
if ( 'OK' === $check->Msg_text ) {
@@ -118,7 +118,7 @@
118118
/* translators: 1: Table name, 2: Error message. */
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;';
124124
if ( 'OK' === $repair->Msg_text ) {
@@ -133,14 +133,14 @@
133133
}
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;';
139139
if ( 'Table is already up to date' === $analyze->Msg_text ) {
140140
/* translators: %s: Table name. */
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;';
146146
if ( 'OK' === $optimize->Msg_text || 'Table is already up to date' === $optimize->Msg_text ) {

0 commit comments

Comments
 (0)