mirror of
https://github.com/WordPress/WordPress.git
synced 2024-10-02 09:07:59 +02:00
General: Introduce wp_is_php_version_acceptable
filter to make the check for triggering PHP version warnings stricter.
The filter is only run if the wordpress.org API considers the PHP version acceptable. This ensures that other plugins or hosting providers can only make this check stricter, but not loosen it. Merges [44788] to the 5.1 branch. Props j-falk, mikeschroder. Fixes #46065. Built from https://develop.svn.wordpress.org/branches/5.1@44789 git-svn-id: http://core.svn.wordpress.org/branches/5.1@44621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
50cc2a57f6
commit
f0c5c319e4
@ -2016,6 +2016,7 @@ final class WP_Privacy_Policy_Content {
|
|||||||
* Checks if the user needs to update PHP.
|
* Checks if the user needs to update PHP.
|
||||||
*
|
*
|
||||||
* @since 5.1.0
|
* @since 5.1.0
|
||||||
|
* @since 5.1.1 Added the {@see 'wp_is_php_version_acceptable'} filter.
|
||||||
*
|
*
|
||||||
* @return array|false $response Array of PHP version data. False on failure.
|
* @return array|false $response Array of PHP version data. False on failure.
|
||||||
*/
|
*/
|
||||||
@ -2054,5 +2055,22 @@ function wp_check_php_version() {
|
|||||||
set_site_transient( 'php_check_' . $key, $response, WEEK_IN_SECONDS );
|
set_site_transient( 'php_check_' . $key, $response, WEEK_IN_SECONDS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( isset( $response['is_acceptable'] ) && $response['is_acceptable'] ) {
|
||||||
|
/**
|
||||||
|
* Filters whether the active PHP version is considered acceptable by WordPress.
|
||||||
|
*
|
||||||
|
* Returning false will trigger a PHP version warning to show up in the admin dashboard to administrators.
|
||||||
|
*
|
||||||
|
* This filter is only run if the wordpress.org Serve Happy API considers the PHP version acceptable, ensuring
|
||||||
|
* that this filter can only make this check stricter, but not loosen it.
|
||||||
|
*
|
||||||
|
* @since 5.1.1
|
||||||
|
*
|
||||||
|
* @param bool $is_acceptable Whether the PHP version is considered acceptable. Default true.
|
||||||
|
* @param string $version PHP version checked.
|
||||||
|
*/
|
||||||
|
$response['is_acceptable'] = (bool) apply_filters( 'wp_is_php_version_acceptable', true, $version );
|
||||||
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.1.1-alpha-44783';
|
$wp_version = '5.1.1-alpha-44789';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user