Ticket #8647: setup-config-php-secure-keys.diff
File setup-config-php-secure-keys.diff, 2.4 KB (added by , 15 years ago) |
---|
-
wp-admin/setup-config.php
29 29 require_once('../wp-includes/compat.php'); 30 30 require_once('../wp-includes/functions.php'); 31 31 require_once('../wp-includes/classes.php'); 32 require_once('../wp-includes/http.php'); 33 require_once('../wp-includes/plugin.php'); 34 require_once('../wp-includes/l10n.php'); 32 35 33 36 if (!file_exists('../wp-config-sample.php')) 34 37 wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'); … … 155 158 if ( !empty($wpdb->error) ) 156 159 wp_die($wpdb->error->get_error_message()); 157 160 161 $response = wp_remote_get('https://api.wordpress.org/secret-key/1.1/'); 162 if ( !is_wp_error($response) ) 163 list($auth, $secure_auth, $logged_in, $nonce) = preg_split('/\n/',$response['body']); 164 158 165 $handle = fopen('../wp-config.php', 'w'); 159 166 160 167 foreach ($configFile as $line_num => $line) { … … 171 178 case "define('DB_HOST'": 172 179 fwrite($handle, str_replace("localhost", $dbhost, $line)); 173 180 break; 181 case "define('AUTH_KEY": 182 is_wp_error($response) ? fwrite($handle, $line) : fwrite($handle, "$auth\r\n"); 183 break; 184 case "define('SECURE_A": 185 is_wp_error($response) ? fwrite($handle, $line) : fwrite($handle, "$secure_auth\r\n"); 186 break; 187 case "define('LOGGED_I": 188 is_wp_error($response) ? fwrite($handle, $line) : fwrite($handle, "$logged_in\r\n"); 189 break; 190 case "define('NONCE_KE": 191 is_wp_error($response) ? fwrite($handle, $line) : fwrite($handle, "$nonce\r\n"); 192 break; 174 193 case '$table_prefix =': 175 194 fwrite($handle, str_replace('wp_', $prefix, $line)); 176 195 break; … … 182 201 chmod('../wp-config.php', 0666); 183 202 184 203 display_header(); 204 205 if ( is_wp_error($response) ) : 185 206 ?> 207 <p>Unique authentication keys were unable to be configured. For added security please configure the 'Authentication Unique Keys' section manually in your <code>wp-config.php</code> file after the install has finished.</p> 208 <?php endif; ?> 209 186 210 <p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to…</p> 187 211 188 212 <p class="step"><a href="install.php" class="button">Run the install</a></p> 213 189 214 <?php 190 215 break; 191 216 }