Themes: Display a message on Themes list table if a theme update requires a higher version of PHP or WordPress.
This applies to the Themes screen in Multisite network admin. Props afragen, SergeyBiryukov. Fixes #48507. See #48491. git-svn-id: https://develop.svn.wordpress.org/trunk@48660 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d67c469b0d
commit
deb78bdf1c
@ -561,7 +561,11 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $allowed && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && get_option( 'stylesheet' ) !== $stylesheet && get_option( 'template' ) !== $stylesheet ) {
|
if ( ! $allowed && ! $this->is_site_themes
|
||||||
|
&& current_user_can( 'delete_themes' )
|
||||||
|
&& get_option( 'stylesheet' ) !== $stylesheet
|
||||||
|
&& get_option( 'template' ) !== $stylesheet
|
||||||
|
) {
|
||||||
$url = add_query_arg(
|
$url = add_query_arg(
|
||||||
array(
|
array(
|
||||||
'action' => 'delete-selected',
|
'action' => 'delete-selected',
|
||||||
|
@ -642,6 +642,12 @@ function wp_theme_update_row( $theme_key, $theme ) {
|
|||||||
|
|
||||||
$active = $theme->is_allowed( 'network' ) ? ' active' : '';
|
$active = $theme->is_allowed( 'network' ) ? ' active' : '';
|
||||||
|
|
||||||
|
$requires_wp = isset( $response['requires'] ) ? $response['requires'] : null;
|
||||||
|
$requires_php = isset( $response['requires_php'] ) ? $response['requires_php'] : null;
|
||||||
|
|
||||||
|
$compatible_wp = is_wp_version_compatible( $requires_wp );
|
||||||
|
$compatible_php = is_php_version_compatible( $compatible_php );
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
'<tr class="plugin-update-tr%s" id="%s" data-slug="%s">' .
|
'<tr class="plugin-update-tr%s" id="%s" data-slug="%s">' .
|
||||||
'<td colspan="%s" class="plugin-update colspanchange">' .
|
'<td colspan="%s" class="plugin-update colspanchange">' .
|
||||||
@ -652,6 +658,7 @@ function wp_theme_update_row( $theme_key, $theme ) {
|
|||||||
$wp_list_table->get_column_count()
|
$wp_list_table->get_column_count()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( $compatible_wp && $compatible_php ) {
|
||||||
if ( ! current_user_can( 'update_themes' ) ) {
|
if ( ! current_user_can( 'update_themes' ) ) {
|
||||||
printf(
|
printf(
|
||||||
/* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number. */
|
/* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number. */
|
||||||
@ -698,6 +705,64 @@ function wp_theme_update_row( $theme_key, $theme ) {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if ( ! $compatible_wp && ! $compatible_php ) {
|
||||||
|
printf(
|
||||||
|
/* translators: %s: Theme name. */
|
||||||
|
__( 'There is a new version of %s available, but it doesn’t work with your versions of WordPress and PHP.' ),
|
||||||
|
$theme['Name']
|
||||||
|
);
|
||||||
|
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
|
||||||
|
printf(
|
||||||
|
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
|
||||||
|
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
|
||||||
|
self_admin_url( 'update-core.php' ),
|
||||||
|
esc_url( wp_get_update_php_url() )
|
||||||
|
);
|
||||||
|
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||||
|
} elseif ( current_user_can( 'update_core' ) ) {
|
||||||
|
printf(
|
||||||
|
/* translators: %s: URL to WordPress Updates screen. */
|
||||||
|
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
|
||||||
|
self_admin_url( 'update-core.php' )
|
||||||
|
);
|
||||||
|
} elseif ( current_user_can( 'update_php' ) ) {
|
||||||
|
printf(
|
||||||
|
/* translators: %s: URL to Update PHP page. */
|
||||||
|
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
|
||||||
|
esc_url( wp_get_update_php_url() )
|
||||||
|
);
|
||||||
|
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||||
|
}
|
||||||
|
} elseif ( ! $compatible_wp ) {
|
||||||
|
printf(
|
||||||
|
/* translators: %s: Theme name. */
|
||||||
|
__( 'There is a new version of %s available, but it doesn’t work with your version of WordPress.' ),
|
||||||
|
$theme['Name']
|
||||||
|
);
|
||||||
|
if ( current_user_can( 'update_core' ) ) {
|
||||||
|
printf(
|
||||||
|
/* translators: %s: URL to WordPress Updates screen. */
|
||||||
|
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
|
||||||
|
self_admin_url( 'update-core.php' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} elseif ( ! $compatible_php ) {
|
||||||
|
printf(
|
||||||
|
/* translators: %s: Theme name. */
|
||||||
|
__( 'There is a new version of %s available, but it doesn’t work with your version of PHP.' ),
|
||||||
|
$theme['Name']
|
||||||
|
);
|
||||||
|
if ( current_user_can( 'update_php' ) ) {
|
||||||
|
printf(
|
||||||
|
/* translators: %s: URL to Update PHP page. */
|
||||||
|
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
|
||||||
|
esc_url( wp_get_update_php_url() )
|
||||||
|
);
|
||||||
|
wp_update_php_annotation( '</p><p><em>', '</em>' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires at the end of the update message container in each
|
* Fires at the end of the update message container in each
|
||||||
|
Loading…
Reference in New Issue
Block a user