Plugins: Only set card button status on plugin install pages.
Previously, the `setCardButtonStatus()` JS function was called when a card had the ID 'plugin-information-footer'. However, the card will only exist on plugin install pages. This caused a failure when updating plugins from the plugin row on `plugins.php` due to an undefined `$card` variable. This adds a guard to ensure that the current page is one of the plugin install pages, preventing the error and allowing plugin updates from the `plugins.php` rows to work as expected. Follow-up to [57545]. Props Presskopp, huzaifaalmesbah, krupajnanda, hellofromTonya, krupalpanchal, costdev. Fixes #60521. Built from https://develop.svn.wordpress.org/trunk@57615 git-svn-id: http://core.svn.wordpress.org/trunk@57116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f361c6f157
commit
f209cd1410
|
@ -478,7 +478,8 @@
|
||||||
wp.updates.updatePlugin = function( args ) {
|
wp.updates.updatePlugin = function( args ) {
|
||||||
var $updateRow, $card, $message, message,
|
var $updateRow, $card, $message, message,
|
||||||
$adminBarUpdates = $( '#wp-admin-bar-updates' ),
|
$adminBarUpdates = $( '#wp-admin-bar-updates' ),
|
||||||
buttonText = __( 'Updating...' );
|
buttonText = __( 'Updating...' ),
|
||||||
|
isPluginInstall = 'plugin-install' === pagenow || 'plugin-install-network' === pagenow;
|
||||||
|
|
||||||
args = _.extend( {
|
args = _.extend( {
|
||||||
success: wp.updates.updatePluginSuccess,
|
success: wp.updates.updatePluginSuccess,
|
||||||
|
@ -493,7 +494,7 @@
|
||||||
_x( 'Updating %s...', 'plugin' ),
|
_x( 'Updating %s...', 'plugin' ),
|
||||||
$updateRow.find( '.plugin-title strong' ).text()
|
$updateRow.find( '.plugin-title strong' ).text()
|
||||||
);
|
);
|
||||||
} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
|
} else if ( isPluginInstall ) {
|
||||||
$card = $( '.plugin-card-' + args.slug + ', #plugin-information-footer' );
|
$card = $( '.plugin-card-' + args.slug + ', #plugin-information-footer' );
|
||||||
$message = $card.find( '.update-now' ).addClass( 'updating-message' );
|
$message = $card.find( '.update-now' ).addClass( 'updating-message' );
|
||||||
message = sprintf(
|
message = sprintf(
|
||||||
|
@ -518,7 +519,7 @@
|
||||||
|
|
||||||
$document.trigger( 'wp-plugin-updating', args );
|
$document.trigger( 'wp-plugin-updating', args );
|
||||||
|
|
||||||
if ( 'plugin-information-footer' === $card.attr('id' ) ) {
|
if ( isPluginInstall && 'plugin-information-footer' === $card.attr( 'id' ) ) {
|
||||||
wp.updates.setCardButtonStatus(
|
wp.updates.setCardButtonStatus(
|
||||||
{
|
{
|
||||||
status: 'updating-plugin',
|
status: 'updating-plugin',
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.5-alpha-57614';
|
$wp_version = '6.5-alpha-57615';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|
Loading…
Reference in New Issue