wp/wp-load.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
    21 /** Define ABSPATH as this file's directory */
    21 /** Define ABSPATH as this file's directory */
    22 define( 'ABSPATH', dirname(__FILE__) . '/' );
    22 define( 'ABSPATH', dirname(__FILE__) . '/' );
    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 /*
       
    27  * If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php
       
    28  * doesn't, load wp-config.php. The secondary check for wp-settings.php has the added benefit
       
    29  * of avoiding cases where the current directory is a nested installation, e.g. / is WordPress(a)
       
    30  * and /blog/ is WordPress(b).
       
    31  *
       
    32  * If neither set of conditions is true, initiate loading the setup process.
       
    33  */
    26 if ( file_exists( ABSPATH . 'wp-config.php') ) {
    34 if ( file_exists( ABSPATH . 'wp-config.php') ) {
    27 
    35 
    28 	/** The config file resides in ABSPATH */
    36 	/** The config file resides in ABSPATH */
    29 	require_once( ABSPATH . 'wp-config.php' );
    37 	require_once( ABSPATH . 'wp-config.php' );
    30 
    38 
    36 } else {
    44 } else {
    37 
    45 
    38 	// A config file doesn't exist
    46 	// A config file doesn't exist
    39 
    47 
    40 	define( 'WPINC', 'wp-includes' );
    48 	define( 'WPINC', 'wp-includes' );
    41 	define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
       
    42 	require_once( ABSPATH . WPINC . '/load.php' );
    49 	require_once( ABSPATH . WPINC . '/load.php' );
    43 	require_once( ABSPATH . WPINC . '/version.php' );
       
    44 
       
    45 	wp_check_php_mysql_versions();
       
    46 	wp_load_translations_early();
       
    47 
    50 
    48 	// Standardize $_SERVER variables across setups.
    51 	// Standardize $_SERVER variables across setups.
    49 	wp_fix_server_vars();
    52 	wp_fix_server_vars();
    50 
    53 
    51 	require_once( ABSPATH . WPINC . '/functions.php' );
    54 	require_once( ABSPATH . WPINC . '/functions.php' );
    52 
    55 
    53 	$path = wp_guess_url() . '/wp-admin/setup-config.php';
    56 	$path = wp_guess_url() . '/wp-admin/setup-config.php';
    54 
    57 
       
    58 	/*
       
    59 	 * We're going to redirect to setup-config.php. While this shouldn't result
       
    60 	 * in an infinite loop, that's a silly thing to assume, don't you think? If
       
    61 	 * we're traveling in circles, our last-ditch effort is "Need more help?"
       
    62 	 */
       
    63 	if ( false === strpos( $_SERVER['REQUEST_URI'], 'setup-config' ) ) {
       
    64 		header( 'Location: ' . $path );
       
    65 		exit;
       
    66 	}
       
    67 
       
    68 	define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
       
    69 	require_once( ABSPATH . WPINC . '/version.php' );
       
    70 
       
    71 	wp_check_php_mysql_versions();
       
    72 	wp_load_translations_early();
       
    73 
    55 	// Die with an error message
    74 	// Die with an error message
    56 	$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  = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>';
    57 	$die .= '<p>' . __( "Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ) . '</p>';
    76 	$die .= '<p>' . __( "Need more help? <a href='https://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ) . '</p>';
    58 	$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 	$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>';
    59 	$die .= '<p><a href="' . $path . '" class="button button-large">' . __( "Create a Configuration File" ) . '</a>';
    78 	$die .= '<p><a href="' . $path . '" class="button button-large">' . __( "Create a Configuration File" ) . '</a>';
    60 
    79 
    61 	wp_die( $die, __( 'WordPress &rsaquo; Error' ) );
    80 	wp_die( $die, __( 'WordPress &rsaquo; Error' ) );
    62 }
    81 }