diff --git a/src/wp-admin/includes/class-plugin-upgrader.php b/src/wp-admin/includes/class-plugin-upgrader.php index c5476c886b..53c7da1ced 100644 --- a/src/wp-admin/includes/class-plugin-upgrader.php +++ b/src/wp-admin/includes/class-plugin-upgrader.php @@ -441,6 +441,31 @@ class Plugin_Upgrader extends WP_Upgrader { return new WP_Error( 'incompatible_archive_no_plugins', $this->strings['incompatible_archive'], __( 'No valid plugins were found.' ) ); } + $requires_php = isset( $info['RequiresPHP'] ) ? $info['RequiresPHP'] : null; + $requires_wp = isset( $info['RequiresWP'] ) ? $info['RequiresWP'] : null; + + if ( ! is_php_version_compatible( $requires_php ) ) { + $error = sprintf( + /* translators: 1: Current PHP version, 2: Version required by the uploaded plugin. */ + __( 'The PHP version on your server is %1$s, however the uploaded plugin requires %2$s.' ), + phpversion(), + $requires_php + ); + + return new WP_Error( 'incompatible_php_required_version', $this->strings['incompatible_archive'], $error ); + } + + if ( ! is_wp_version_compatible( $requires_wp ) ) { + $error = sprintf( + /* translators: 1: Current WordPress version, 2: Version required by the uploaded plugin. */ + __( 'Your WordPress version is %1$s, however the uploaded plugin requires %2$s.' ), + $GLOBALS['wp_version'], + $requires_wp + ); + + return new WP_Error( 'incompatible_wp_required_version', $this->strings['incompatible_archive'], $error ); + } + return $source; } diff --git a/src/wp-admin/includes/class-theme-installer-skin.php b/src/wp-admin/includes/class-theme-installer-skin.php index 76d2030f6d..cd6145a978 100644 --- a/src/wp-admin/includes/class-theme-installer-skin.php +++ b/src/wp-admin/includes/class-theme-installer-skin.php @@ -221,7 +221,7 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin { echo '