[wp-trac] [WordPress Trac] #43986: Disable "Install Plugin" button for PHP required version mismatch

WordPress Trac noreply at wordpress.org
Tue Jun 12 03:56:19 UTC 2018


#43986: Disable "Install Plugin" button for PHP required version mismatch
---------------------------------------------------+-----------------------
 Reporter:  schlessera                             |       Owner:  afragen
     Type:  task (blessed)                         |      Status:  assigned
 Priority:  normal                                 |   Milestone:  5.0
Component:  Plugins                                |     Version:
 Severity:  major                                  |  Resolution:
 Keywords:  needs-unit-tests servehappy has-patch  |     Focuses:
---------------------------------------------------+-----------------------
Changes (by flixos90):

 * keywords:  needs-unit-tests servehappy dev-feedback has-patch => needs-
     unit-tests servehappy has-patch


Comment:

 Thanks for the updated patch @afragen!

 A first round of code review:

 * In the More Details view, when the required WordPress version is not
 met, please use the text as we discussed. In your current patch it still
 uses the less precise and less obvious text that is used in trunk at the
 moment ("This plugin has <strong>not been marked as compatible</strong>
 with your version of WordPress.", this can also be seen in your second
 screenshot).
 * Try to simplify the checks that lead to `$compatible_php` a bit. The
 extra `$tested_php` variable is not necessary and makes the code hard to
 read. This applies to both `class-wp-plugin-install-list-table.php` and
 `plugin-install.php`. It could simply become: `$compatible_php = empty(
 $api->requires_php ) || version_compare( substr( PHP_VERSION, 0, strlen(
 $api->requires_php ) ), $api->requires_php, '>=' );` In other words, when
 the no required PHP version is given, it should be considered compatible
 by definition.
 * The checks for `$can_install` can then simply become `$compatible_php &&
 $compatible_wp`.
 * The checks for whether to show a notice about insufficient PHP version
 can simply become `! $compatible_php`.
 * Please use `echo` instead of `print`.
 * Please use regular spacing instead of ` `.
 * The localized strings with links are hard to read. In such cases where
 links are part of regular sentences, please include the anchor elements
 ''in'' the translatable string, and use placeholders for the URLs only. In
 the current patch, it is correct in `plugin-install.php`, but not in
 `class-wp-plugin-install-list-table.php`.
 * Please pay particular attention to translator comments. They should have
 the form `/* translators: %s: description */` when a single `%s`
 placeholder is present, or `/* translators: 1: first description, 2:
 second description */` in case of multiple numbered placeholders.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43986#comment:76>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list