Don't include functions.php in wp_load_translations_early()

to avoid a parse error in a PHP4 environment (caused by use of
the clone keyword in option.php).

Manually include functions.php in the rare situations where it
is not already included by the time we need to load translations
early.

Remove the functions.php dependency by switching the wp_die() calls
to die(), in wp_check_php_mysql_versions().

props SergeyBiryukov, see #21316, for trunk.




git-svn-id: http://core.svn.wordpress.org/trunk@21715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-09-04 02:38:37 +00:00
parent 1635740139
commit c97452d955
3 changed files with 10 additions and 7 deletions

View File

@ -44,12 +44,14 @@ define('WP_DEBUG', false);
require(ABSPATH . WPINC . '/load.php'); require(ABSPATH . WPINC . '/load.php');
require(ABSPATH . WPINC . '/version.php'); require(ABSPATH . WPINC . '/version.php');
// Also loads functions.php, plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php)
wp_load_translations_early();
// Check for the required PHP version and for the MySQL extension or a database drop-in. // Check for the required PHP version and for the MySQL extension or a database drop-in.
wp_check_php_mysql_versions(); wp_check_php_mysql_versions();
require_once(ABSPATH . WPINC . '/functions.php');
// Also loads plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php)
wp_load_translations_early();
// Turn register_globals off. // Turn register_globals off.
wp_unregister_GLOBALS(); wp_unregister_GLOBALS();

View File

@ -105,12 +105,12 @@ function wp_check_php_mysql_versions() {
$php_version = phpversion(); $php_version = phpversion();
if ( version_compare( $required_php_version, $php_version, '>' ) ) { if ( version_compare( $required_php_version, $php_version, '>' ) ) {
wp_load_translations_early(); wp_load_translations_early();
wp_die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) ); die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) );
} }
if ( ! extension_loaded( 'mysql' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) { if ( ! extension_loaded( 'mysql' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
wp_load_translations_early(); wp_load_translations_early();
wp_die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) ); die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
} }
} }
@ -709,7 +709,6 @@ function wp_load_translations_early() {
require_once ABSPATH . WPINC . '/locale.php'; require_once ABSPATH . WPINC . '/locale.php';
// General libraries // General libraries
require_once ABSPATH . WPINC . '/functions.php';
require_once ABSPATH . WPINC . '/plugin.php'; require_once ABSPATH . WPINC . '/plugin.php';
$locales = $locations = array(); $locales = $locations = array();

View File

@ -48,8 +48,10 @@ if ( file_exists( ABSPATH . 'wp-config.php') ) {
require_once( ABSPATH . WPINC . '/load.php' ); require_once( ABSPATH . WPINC . '/load.php' );
require_once( ABSPATH . WPINC . '/version.php' ); require_once( ABSPATH . WPINC . '/version.php' );
wp_load_translations_early();
wp_check_php_mysql_versions(); wp_check_php_mysql_versions();
wp_load_translations_early();
require_once( ABSPATH . WPINC . '/functions.php' );
// Die with an error message // Die with an error message
$die = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>'; $die = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>';