Make WordPress Core


Ignore:
Timestamp:
04/12/2019 11:55:19 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Plugins: Introduce is_wp_version_compatible() and is_php_version_compatible() for checking compatibility with the current WordPress or PHP version.

Props afragen.
Fixes #46599.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/plugin-install.php

    r44937 r45185  
    755755    <div id="section-holder" class="wrap">
    756756    <?php
    757     $wp_version = get_bloginfo( 'version' );
    758 
    759     $compatible_php = ( empty( $api->requires_php ) || version_compare( phpversion(), $api->requires_php, '>=' ) );
    760     $tested_wp      = ( empty( $api->tested ) || version_compare( $wp_version, $api->tested, '<=' ) );
    761     $compatible_wp  = ( empty( $api->requires ) || version_compare( $wp_version, $api->requires, '>=' ) );
     757    $requires_php = isset( $api->requires_php ) ? $api->requires_php : null;
     758    $requires_wp  = isset( $api->requires ) ? $api->requires : null;
     759
     760    $compatible_php = is_php_version_compatible( $requires_php );
     761    $compatible_wp  = is_wp_version_compatible( $requires_wp );
     762    $tested_wp      = ( empty( $api->tested ) || version_compare( get_bloginfo( 'version' ), $api->tested, '<=' ) );
    762763
    763764    if ( ! $compatible_php ) {
Note: See TracChangeset for help on using the changeset viewer.