Build/Test Tools: Use a non-zero exit code in wp_check_php_mysql_versions() when minimum PHP or MySQL requirements are not met.

This allows automated scripts and test suites to interpret the result correctly.

Props jrf, spacedmonkey.
Merges [45350] to the 5.2 branch.
Fixes #47169.
Built from https://develop.svn.wordpress.org/branches/5.2@45351


git-svn-id: http://core.svn.wordpress.org/branches/5.2@45162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-05-17 12:38:53 +00:00
parent 50cec5733c
commit a582a30bf4
2 changed files with 14 additions and 7 deletions

View File

@ -136,16 +136,23 @@ function wp_check_php_mysql_versions() {
header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 ); header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 );
header( 'Content-Type: text/html; charset=utf-8' ); header( 'Content-Type: text/html; charset=utf-8' );
/* translators: 1: Current PHP version number, 2: WordPress version number, 3: Minimum required PHP version number */ /* translators: 1: Current PHP version number, 2: WordPress version number, 3: Minimum required PHP version number */
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 ) ); printf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version );
exit( 1 );
} }
if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) { if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
require_once( ABSPATH . WPINC . '/functions.php' );
wp_load_translations_early(); wp_load_translations_early();
$args = array(
$protocol = wp_get_server_protocol(); 'exit' => false,
header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 ); 'code' => 'mysql_not_found',
header( 'Content-Type: text/html; charset=utf-8' ); );
die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) ); wp_die(
__( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ),
__( 'Insufficient Requirements' ),
$args
);
exit( 1 );
} }
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.2.1-alpha-45349'; $wp_version = '5.2.1-alpha-45351';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.