Skip to content

Commit 91f68a7

Browse files
committed
Adjust warning text
1 parent f2153c8 commit 91f68a7

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

features/plugin.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ Feature: Manage WordPress plugins
836836
When I try `wp plugin update wp-super-cache`
837837
Then STDERR should contain:
838838
"""
839-
Warning: wp-super-cache: Requires a newer version of WordPress
839+
Warning: wp-super-cache: This update requires WordPress version
840840
"""
841841

842842
@less-than-php-8.0 @require-wp-5.6
@@ -862,6 +862,6 @@ Feature: Manage WordPress plugins
862862
When I try `wp plugin update edit-flow`
863863
Then STDERR should contain:
864864
"""
865-
Warning: edit-flow: Requires a newer version of PHP
865+
Warning: edit-flow: This update requires PHP version
866866
"""
867867

features/theme.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,5 +646,5 @@ Feature: Manage WordPress themes
646646
When I try `wp theme update kadence`
647647
Then STDERR should contain:
648648
"""
649-
Warning: kadence: Requires a newer version of WordPress
649+
Warning: kadence: This update requires WordPress version
650650
"""

src/Plugin_Command.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,6 @@ protected function get_item_list() {
772772
$duplicate_names[ $name ] = array();
773773
}
774774

775-
$php_version = PHP_VERSION;
776-
777775
$requires = isset( $update_info ) && isset( $update_info['requires'] ) ? $update_info['requires'] : null;
778776
$requires_php = isset( $update_info ) && isset( $update_info['requires_php'] ) ? $update_info['requires_php'] : null;
779777

@@ -783,8 +781,13 @@ protected function get_item_list() {
783781
$compatible_php = empty( $requires_php ) || version_compare( PHP_VERSION, $requires_php, '>=' );
784782

785783
if ( ! $compatible_php ) {
786-
$update = 'unavailable';
787-
$update_unavailable_reason = "Requires a newer version of PHP [$requires_php] than available [$php_version]";
784+
$update = 'unavailable';
785+
786+
$update_unavailable_reason = sprintf(
787+
'This update requires PHP version %s, but the version installed is %s.',
788+
$requires_php,
789+
PHP_VERSION
790+
);
788791
} else {
789792
$update = $update_info ? 'available' : 'none';
790793
}
@@ -818,9 +821,7 @@ protected function get_item_list() {
818821
'requires_php' => $requires_php,
819822
'wporg_status' => $wporg_info['status'],
820823
'wporg_last_updated' => $wporg_info['last_updated'],
821-
822824
'recently_active' => in_array( $file, array_keys( $recently_active ), true ),
823-
824825
'update_unavailable_reason' => isset( $update_unavailable_reason ) ? $update_unavailable_reason : '',
825826
];
826827

@@ -871,7 +872,7 @@ protected function get_item_list() {
871872
$items[ $file ]['requires'] = isset( $plugin_update_info->requires ) ? $plugin_update_info->requires : null;
872873
$items[ $file ]['requires_php'] = isset( $plugin_update_info->requires_php ) ? $plugin_update_info->requires_php : null;
873874

874-
$reason = "Requires a newer version of WordPress [$plugin_update_info->requires] than installed [$wp_version]";
875+
$reason = "This update requires WordPress version $plugin_update_info->requires, but the version installed is $wp_version.";
875876

876877
$items[ $file ]['update_unavailable_reason'] = $reason;
877878

src/WP_CLI/ParseThemeNameInput.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ private function get_all_themes() {
9494
$compatible_wp = empty( $requires ) || version_compare( $wp_version, $requires, '>=' );
9595

9696
if ( ! $compatible_php ) {
97-
$update = 'unavailable';
97+
$update = 'unavailable';
98+
9899
$update_unavailable_reason = sprintf(
99-
'Requires a newer version of PHP [%s] than installed [%s]',
100+
'This update requires PHP version %s, but the version installed is %s.',
100101
$requires_php,
101102
PHP_VERSION
102103
);
@@ -105,8 +106,9 @@ private function get_all_themes() {
105106
}
106107

107108
if ( ! $compatible_wp ) {
108-
$update = 'unavailable';
109-
$update_unavailable_reason = "Requires a newer version of WordPress [$requires] than installed [$wp_version]";
109+
$update = 'unavailable';
110+
111+
$update_unavailable_reason = "This update requires WordPress version $requires, but the version installed is $wp_version.";
110112
} else {
111113
$update = $update_info ? 'available' : 'none';
112114
}

0 commit comments

Comments
 (0)