Make WordPress Core

Ticket #37264: 37264-2.patch

File 37264-2.patch, 1.7 KB (added by sibprogrammer, 9 years ago)
  • wp-admin/setup-config.php

    diff --git wp-admin/setup-config.php wp-admin/setup-config.php
    index 1ad40fc..9550e9d 100644
    switch($step) { 
    215215                        <td><input name="prefix" id="prefix" type="text" value="wp_" size="25" /></td>
    216216                        <td><?php _e( 'If you want to run multiple WordPress installations in a single database, change this.' ); ?></td>
    217217                </tr>
     218                <?php
     219                        $tmp_file = tempnam(sys_get_temp_dir(), 'wp');
     220                        $tmp_file_owner = fileowner($tmp_file);
     221                        unlink($tmp_file);
     222                ?>
     223                <?php if (is_writable(ABSPATH) && $tmp_file_owner != fileowner(__FILE__)): ?>
     224                <tr>
     225                        <td scope="row" colspan="3">
     226                                <input name="wp_config_write" id="wp_config_write" type="checkbox" value="1" />
     227                                <?php _e( 'Allow other system users to write into wp-config.php' ); ?>
     228                        </td>
     229                </tr>
     230                <?php endif; ?>
    218231        </table>
    219232        <?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="1" /><?php } ?>
    220233        <input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" />
    switch($step) { 
    232245        $pwd = trim( wp_unslash( $_POST[ 'pwd' ] ) );
    233246        $dbhost = trim( wp_unslash( $_POST[ 'dbhost' ] ) );
    234247        $prefix = trim( wp_unslash( $_POST[ 'prefix' ] ) );
     248        $wp_config_write = isset($_POST[ 'wp_config_write']) && '1' === $_POST[ 'wp_config_write'];
    235249
    236250        $step_1 = 'setup-config.php?step=1';
    237251        $install = 'install.php';
    if ( ! /iPad|iPod|iPhone/.test( navigator.userAgent ) ) { 
    398412                        fwrite( $handle, $line );
    399413                }
    400414                fclose( $handle );
    401                 chmod( $path_to_wp_config, 0666 );
     415                chmod( $path_to_wp_config, $wp_config_write ? 0666 : 0600 );
    402416                setup_config_display_header();
    403417?>
    404418<h1 class="screen-reader-text"><?php _e( 'Successful database connection' ) ?></h1>