Plugins: Disable "Update Now" button for plugins that require a higher version of PHP or WordPress.

This complements disabling the "Install Now" button in [43436].

Props afragen.
Fixes #46677. See #43986.
Built from https://develop.svn.wordpress.org/trunk@45043


git-svn-id: http://core.svn.wordpress.org/trunk@44852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-03-27 22:11:53 +00:00
parent 418afaa938
commit 179c2ea230
2 changed files with 18 additions and 11 deletions

View File

@ -537,16 +537,23 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
case 'update_available': case 'update_available':
if ( $status['url'] ) { if ( $status['url'] ) {
$action_links[] = sprintf( if ( $compatible_php && $compatible_wp ) {
'<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>', $action_links[] = sprintf(
esc_attr( $status['file'] ), '<a class="update-now button aria-button-if-js" data-plugin="%s" data-slug="%s" href="%s" aria-label="%s" data-name="%s">%s</a>',
esc_attr( $plugin['slug'] ), esc_attr( $status['file'] ),
esc_url( $status['url'] ), esc_attr( $plugin['slug'] ),
/* translators: %s: plugin name and version */ esc_url( $status['url'] ),
esc_attr( sprintf( __( 'Update %s now' ), $name ) ), /* translators: %s: plugin name and version */
esc_attr( $name ), esc_attr( sprintf( __( 'Update %s now' ), $name ) ),
__( 'Update Now' ) esc_attr( $name ),
); __( 'Update Now' )
);
} else {
$action_links[] = sprintf(
'<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
_x( 'Cannot Update', 'plugin' )
);
}
} }
break; break;

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.2-alpha-45042'; $wp_version = '5.2-alpha-45043';
/** /**
* 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.