11 * |
11 * |
12 * Will also search for wp-config.php in WordPress' parent |
12 * Will also search for wp-config.php in WordPress' parent |
13 * directory to allow the WordPress directory to remain |
13 * directory to allow the WordPress directory to remain |
14 * untouched. |
14 * untouched. |
15 * |
15 * |
16 * @internal This file must be parsable by PHP4. |
|
17 * |
|
18 * @package WordPress |
16 * @package WordPress |
19 */ |
17 */ |
20 |
18 |
21 /** Define ABSPATH as this file's directory */ |
19 /** Define ABSPATH as this file's directory */ |
22 define( 'ABSPATH', dirname(__FILE__) . '/' ); |
20 if ( ! defined( 'ABSPATH' ) ) { |
|
21 define( 'ABSPATH', dirname( __FILE__ ) . '/' ); |
|
22 } |
23 |
23 |
24 error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
24 error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
25 |
25 |
26 /* |
26 /* |
27 * If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php |
27 * If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php |
34 if ( file_exists( ABSPATH . 'wp-config.php') ) { |
34 if ( file_exists( ABSPATH . 'wp-config.php') ) { |
35 |
35 |
36 /** The config file resides in ABSPATH */ |
36 /** The config file resides in ABSPATH */ |
37 require_once( ABSPATH . 'wp-config.php' ); |
37 require_once( ABSPATH . 'wp-config.php' ); |
38 |
38 |
39 } elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-settings.php' ) ) { |
39 } elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) { |
40 |
40 |
41 /** The config file resides one level above ABSPATH but is not part of another install */ |
41 /** The config file resides one level above ABSPATH but is not part of another installation */ |
42 require_once( dirname(ABSPATH) . '/wp-config.php' ); |
42 require_once( dirname( ABSPATH ) . '/wp-config.php' ); |
43 |
43 |
44 } else { |
44 } else { |
45 |
45 |
46 // A config file doesn't exist |
46 // A config file doesn't exist |
47 |
47 |
70 |
70 |
71 wp_check_php_mysql_versions(); |
71 wp_check_php_mysql_versions(); |
72 wp_load_translations_early(); |
72 wp_load_translations_early(); |
73 |
73 |
74 // Die with an error message |
74 // Die with an error message |
75 $die = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>'; |
75 $die = sprintf( |
76 $die .= '<p>' . __( "Need more help? <a href='https://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ) . '</p>'; |
76 /* translators: %s: wp-config.php */ |
77 $die .= '<p>' . __( "You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ) . '</p>'; |
77 __( "There doesn't seem to be a %s file. I need this before we can get started." ), |
|
78 '<code>wp-config.php</code>' |
|
79 ) . '</p>'; |
|
80 $die .= '<p>' . sprintf( |
|
81 /* translators: %s: Codex URL */ |
|
82 __( "Need more help? <a href='%s'>We got it</a>." ), |
|
83 __( 'https://codex.wordpress.org/Editing_wp-config.php' ) |
|
84 ) . '</p>'; |
|
85 $die .= '<p>' . sprintf( |
|
86 /* translators: %s: wp-config.php */ |
|
87 __( "You can create a %s file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ), |
|
88 '<code>wp-config.php</code>' |
|
89 ) . '</p>'; |
78 $die .= '<p><a href="' . $path . '" class="button button-large">' . __( "Create a Configuration File" ) . '</a>'; |
90 $die .= '<p><a href="' . $path . '" class="button button-large">' . __( "Create a Configuration File" ) . '</a>'; |
79 |
91 |
80 wp_die( $die, __( 'WordPress › Error' ) ); |
92 wp_die( $die, __( 'WordPress › Error' ) ); |
81 } |
93 } |