Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (6 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

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

    r42205 r42343  
    66 * @subpackage Database
    77 */
    8 define('WP_REPAIRING', true);
     8define( 'WP_REPAIRING', true );
    99
    1010require_once( dirname( dirname( dirname( __FILE__ ) ) ) . '/wp-load.php' );
     
    6969        echo '<p>' . sprintf( __( 'While you are editing your %1$s file, take a moment to make sure you have all 8 keys and that they are unique. You can generate these using the <a href="%2$s">WordPress.org secret key service</a>.' ), '<code>wp-config.php</code>', 'https://api.wordpress.org/secret-key/1.1/salt/' ) . '</p>';
    7070    }
    71 
    7271} elseif ( isset( $_GET['repair'] ) ) {
    7372
     
    7574
    7675    $optimize = 2 == $_GET['repair'];
    77     $okay = true;
     76    $okay     = true;
    7877    $problems = array();
    7978
     
    8180
    8281    // Sitecategories may not exist if global terms are disabled.
    83     $query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->sitecategories ) );
     82    $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->sitecategories ) );
    8483    if ( is_multisite() && ! $wpdb->get_var( $query ) ) {
    8584        unset( $tables['sitecategories'] );
     
    105104        } else {
    106105            /* translators: 1: table name, 2: error message, */
    107             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>" );
     106            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>" );
    108107
    109108            $repair = $wpdb->get_row( "REPAIR TABLE $table" );
     
    116115                /* translators: 1: table name, 2: error message, */
    117116                echo sprintf( __( 'Failed to repair the %1$s table. Error: %2$s' ), "<code>$table</code>", "<code>$check->Msg_text</code>" ) . '<br />';
    118                 $problems[$table] = $check->Msg_text;
    119                 $okay = false;
     117                $problems[ $table ] = $check->Msg_text;
     118                $okay               = false;
    120119            }
    121120        }
     
    125124
    126125            echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
    127             if ( 'Table is already up to date' == $check->Msg_text )  {
     126            if ( 'Table is already up to date' == $check->Msg_text ) {
    128127                /* translators: %s: table name */
    129128                printf( __( 'The %s table is already optimized.' ), "<code>$table</code>" );
     
    145144
    146145    if ( $problems ) {
    147         printf( '<p>' . __('Some database problems could not be repaired. Please copy-and-paste the following list of errors to the <a href="%s">WordPress support forums</a> to get additional assistance.') . '</p>', __( 'https://wordpress.org/support/forum/how-to-and-troubleshooting' ) );
     146        printf( '<p>' . __( 'Some database problems could not be repaired. Please copy-and-paste the following list of errors to the <a href="%s">WordPress support forums</a> to get additional assistance.' ) . '</p>', __( 'https://wordpress.org/support/forum/how-to-and-troubleshooting' ) );
    148147        $problem_output = '';
    149         foreach ( $problems as $table => $problem )
     148        foreach ( $problems as $table => $problem ) {
    150149            $problem_output .= "$table: $problem\n";
     150        }
    151151        echo '<p><textarea name="errors" id="errors" rows="20" cols="60">' . esc_textarea( $problem_output ) . '</textarea></p>';
    152152    } else {
     
    157157    echo '<h1 class="screen-reader-text">' . __( 'WordPress database repair' ) . '</h1>';
    158158
    159     if ( isset( $_GET['referrer'] ) && 'is_blog_installed' == $_GET['referrer'] )
     159    if ( isset( $_GET['referrer'] ) && 'is_blog_installed' == $_GET['referrer'] ) {
    160160        echo '<p>' . __( 'One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the &#8220;Repair Database&#8221; button. Repairing can take a while, so please be patient.' ) . '</p>';
    161     else
     161    } else {
    162162        echo '<p>' . __( 'WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient.' ) . '</p>';
     163    }
    163164?>
    164165    <p class="step"><a class="button button-large" href="repair.php?repair=1"><?php _e( 'Repair Database' ); ?></a></p>
Note: See TracChangeset for help on using the changeset viewer.