Make WordPress Core

Changeset 45350


Ignore:
Timestamp:
05/17/2019 12:33:50 PM (5 years ago)
Author:
SergeyBiryukov
Message:

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.
Fixes #47169.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/load.php

    r45116 r45350  
    137137        header( 'Content-Type: text/html; charset=utf-8' );
    138138        /* translators: 1: Current PHP version number, 2: WordPress version number, 3: Minimum required PHP version number */
    139         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 ) );
     139        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 );
     140        exit( 1 );
    140141    }
    141142
    142143    if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
     144        require_once( ABSPATH . WPINC . '/functions.php' );
    143145        wp_load_translations_early();
    144 
    145         $protocol = wp_get_server_protocol();
    146         header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 );
    147         header( 'Content-Type: text/html; charset=utf-8' );
    148         die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
     146        $args = array(
     147            'exit' => false,
     148            'code' => 'mysql_not_found',
     149        );
     150        wp_die(
     151            __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ),
     152            __( 'Insufficient Requirements' ),
     153            $args
     154        );
     155        exit( 1 );
    149156    }
    150157}
Note: See TracChangeset for help on using the changeset viewer.