Changeset 11705
- Timestamp:
- 07/09/2009 09:35:47 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/setup-config.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/setup-config.php
r11301 r11705 35 35 36 36 $configFile = file(ABSPATH . 'wp-config-sample.php'); 37 38 if ( !is_writable(ABSPATH))39 wp_die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually.");40 37 41 38 // Check if wp-config.php has been created … … 156 153 wp_die($wpdb->error->get_error_message()); 157 154 158 $handle = fopen(ABSPATH . 'wp-config.php', 'w');159 160 155 foreach ($configFile as $line_num => $line) { 161 156 switch (substr($line,0,16)) { 162 157 case "define('DB_NAME'": 163 fwrite($handle, str_replace("putyourdbnamehere", $dbname, $line));158 $configFile[$line_num] = str_replace("putyourdbnamehere", $dbname, $line); 164 159 break; 165 160 case "define('DB_USER'": 166 fwrite($handle, str_replace("'usernamehere'", "'$uname'", $line));161 $configFile[$line_num] = str_replace("'usernamehere'", "'$uname'", $line); 167 162 break; 168 163 case "define('DB_PASSW": 169 fwrite($handle, str_replace("'yourpasswordhere'", "'$passwrd'", $line));164 $configFile[$line_num] = str_replace("'yourpasswordhere'", "'$passwrd'", $line); 170 165 break; 171 166 case "define('DB_HOST'": 172 fwrite($handle, str_replace("localhost", $dbhost, $line));167 $configFile[$line_num] = str_replace("localhost", $dbhost, $line); 173 168 break; 174 169 case '$table_prefix =': 175 fwrite($handle, str_replace('wp_', $prefix, $line)); 176 break; 177 default: 178 fwrite($handle, $line); 170 $configFile[$line_num] = str_replace('wp_', $prefix, $line); 171 break; 179 172 } 180 173 } 181 fclose($handle); 182 chmod(ABSPATH . 'wp-config.php', 0666); 183 184 display_header(); 174 if ( ! is_writable(ABSPATH) ) : 175 display_header(); 176 ?> 177 <p>Sorry, but I can't write the <code>wp-config.php</code> file.</p> 178 <p>You can create the <code>wp-config.php</code> manually and paste the following text into it.</p> 179 <textarea cols="90" rows="15"><?php 180 foreach( $configFile as $line ) { 181 echo htmlentities($line); 182 } 183 ?></textarea> 184 <p>After you've done that, click "Run the install."</p> 185 <p class="step"><a href="install.php" class="button">Run the install</a></p> 186 <?php 187 else : 188 $handle = fopen(ABSPATH . 'wp-config.php', 'w'); 189 foreach( $configFile as $line ) { 190 fwrite($handle, $line); 191 } 192 fclose($handle); 193 chmod(ABSPATH . 'wp-config.php', 0666); 194 display_header(); 185 195 ?> 186 196 <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> … … 188 198 <p class="step"><a href="install.php" class="button">Run the install</a></p> 189 199 <?php 200 endif; 190 201 break; 191 202 }
Note: See TracChangeset
for help on using the changeset viewer.