Make WordPress Core

Changeset 42218 for trunk


Ignore:
Timestamp:
11/23/2017 05:23:01 AM (9 years ago)
Author:
pento
Message:

Setup: Allow for wp-config-sample.php to be formatted according to coding standards.

When the setup process reads wp-config-sample.php, it assumes that there are no spaces inside the brackes of the define()s. Unfortunately, this doesn't match our coding standards, so will no longer work correctly once we start enforcing them.

This also improves coding standards of the generated wp-config.php file.

See #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/setup-config.php

    r42217 r42218  
    333333                }
    334334
    335                 if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
     335                if ( ! preg_match( '/^define\(\s*\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
    336336                        continue;
    337337
     
    344344                        case 'DB_PASSWORD' :
    345345                        case 'DB_HOST'     :
    346                                 $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
     346                                $config_file[ $line_num ] = "define( '" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "' );\r\n";
    347347                                break;
    348348                        case 'DB_CHARSET'  :
    349349                                if ( 'utf8mb4' === $wpdb->charset || ( ! $wpdb->charset && $wpdb->has_cap( 'utf8mb4' ) ) ) {
    350                                         $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'utf8mb4');\r\n";
     350                                        $config_file[ $line_num ] = "define( '" . $constant . "'," . $padding . "'utf8mb4' );\r\n";
    351351                                }
    352352                                break;
     
    359359                        case 'LOGGED_IN_SALT'   :
    360360                        case 'NONCE_SALT'       :
    361                                 $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
     361                                $config_file[ $line_num ] = "define( '" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "' );\r\n";
    362362                                break;
    363363                }
Note: See TracChangeset for help on using the changeset viewer.