Make WordPress Core

Opened 4 months ago

Last modified 2 days ago

#61381 new defect (bug)

Bulk update plugins no longer working when 1 Plugin failed to update

Reported by: rickhaer's profile rickhaer Owned by:
Milestone: 6.7 Priority: normal
Severity: normal Version: 6.5
Component: Plugins Keywords: has-testing-info has-screenshots has-patch needs-testing
Focuses: Cc:

Description

Hi! In "older" WordPress Version i used to just bulk update plugins when there were multiple plugin updates todo, which was always working fine, 1 after 1 got updated. Also when one failed, the next one was updated successfully.

But i think since WP Version 6.4.4 (not quite sure if it is only since this version or even a version before) when i do that, and 1 update failed than all the next updates are no longer updating. I need to refresh the page and do the bulk update again. So everytime 1 plugin update failed in between, all the plugin after the failed ones are no longer updating.

Steps to reproduce:

  1. Go to wp-admin/plugins.php when there are multiple updates
  2. Update them all directly after each other, so scroll threw and hit "Update now" everywhere.
  3. Make sure 1 Update failed in between (maybe by not putting in a license key into a pro update)
  4. You will see all the updates after will not update any more and you need to refresh the page.

I would really like to see, that this is working again, cause it cost a lot more time now to update, since at my sites for some reason it happens a lot that some plugin updates failing.

Attachments (6)

61381.diff (1.2 KB) - added by siliconforks 4 months ago.
This patch is very similar to r57615.
01-bulk-plugins-updates.png (98.8 KB) - added by circlecube 4 weeks ago.
02-bulk-plugins-update-in-process.png (103.6 KB) - added by circlecube 4 weeks ago.
03-bulk-plugins-update-error.png (106.8 KB) - added by circlecube 4 weeks ago.
04-bulk-plugins-update-js-error.png (36.0 KB) - added by circlecube 4 weeks ago.
05-bulk-plugins-updates-error-continues-with-patch.png (106.0 KB) - added by circlecube 4 weeks ago.

Download all attachments as: .zip

Change History (16)

@siliconforks
4 months ago

This patch is very similar to r57615.

#1 @siliconforks
4 months ago

This issue is similar to #60521 (and the patch I've proposed is very similar to the fix).

#2 @rickhaer
4 months ago

@siliconforks this seems not to be the same as your patch since this also happens in 6.5.4 still. Its not happening for all Plugins. So normal Plugin updates are working fine. But when one Plugin failed to update all in the loop after the one failed will not update anymore and the page need to be reloaded and the bulk update started again.

#3 @siliconforks
4 months ago

It's not the same bug as #60521, but the required fix is very similar to the fix that @costdev wrote for that bug (so much so that I copied most of the code from his fix).

I'm just making sure @costdev receives credit since I stole most of the code from him 😉

#4 @ironprogrammer
7 weeks ago

  • Keywords has-testing-info has-screenshots has-patch needs-testing added
  • Version changed from 6.5.4 to 6.5

Welcome to Trac, and thank you for the report, @rickhaer!

I can confirm this regression was introduced with WordPress 6.5. Thanks for looking into a fix, @siliconforks.

Reproduction Report

Reproduction Test Steps

  1. In WordPress 6.5+, install a previous version of at least two plugins. In 6.5, Akismet was already outdated at v5.2, and I used wp plugin install query-monitor --version=3.16.3 to install the previous version of Query Monitor.
  2. Simulate a plugin update failure. I used an example mu-plugin to cause Akismet's update to fail (Akismet was at the top of the plugin list).
  3. Trigger the plugin update failure by checking the box for each of these plugins, and selecting "Update" from the Bulk actions dropdown. Click Apply.
  4. 👀 Observe the update status for each of the checked plugins.

Expected Results

  • During a bulk plugin update, when an individual update fails, other plugin updates should continue to process.
  • When a bulk plugin update failure occurs, an admin notice should be displayed that highlights the failure(s).

Environment

  • Hardware: MacBook Pro Apple M1 Pro
  • OS: macOS 14.6.1
  • Browser: Safari 17.6
  • Server: nginx/1.27.0
  • PHP: 8.2.22
  • MySQL: 8.0.27
  • WordPress: 6.4.5, 6.5
  • Active Plugins:
    • plugin-update-failure (test mu plugin to cause Akismet's update to fail)
    • db.php (drop-in for SQLite)

Actual Results

  • Reproduced: The simulated plugin update failure caused subsequent plugin updates to halt.
  • Reproduced: The admin notice of failed updates is not visible.

Supplemental Artifacts

Figure 1: Bulk update plugin failure in WP 6.4.5 and earlier.

https://cldup.com/HT1kuqoGIg-3000x3000.png

🐞 Figure 2: Bulk update plugin failure in WP 6.5 and later.

https://cldup.com/-YqZ5cT0aX.png

#5 @ironprogrammer
7 weeks ago

  • Keywords changes-requested added

UPDATED

@siliconforks, thanks for the fix! Apologies for the updated report -- I should have tested the patch in trunk first.

Test Report

Patch tested: https://core.trac.wordpress.org/attachment/ticket/61381/61381.diff 👍🏻

Edit: I tested the changes to updates.js by applying the patch in wordpress-develop:trunk, running npm run build:dev, and clearing the browser cache.

Environment

  • Hardware: MacBook Pro Apple M1 Pro
  • OS: macOS 14.6.1
  • Browser: Safari 17.6
  • Server: nginx/1.27.0
  • PHP: 8.2.22
  • SQLite: 3.43.2
  • WordPress: trunk
  • Theme: twentytwentythree v1.2
  • Active Plugins:
    • plugin-update-failure (test mu plugin to trigger Akismet update failure, see comment:4)
    • db.php (drop-in for SQLite)

Actual Results

  • ✅ During bulk update, after a plugin update failure, subsequent updates proceed successfully.
  • ✅ After a failed bulk update, the update failures admin notice displays the failing plugin(s).

Additional Notes

In my original testing of the patch against WP 6.5, the updates continued after an error, but the admin notice for the failure didn't render as expected screenshot. There are other UI/JS changes since 6.5 that accounted for this result, and as this won't be backported, I now realize that testing the fix in 6.5 doesn't matter 😅.

Last edited 7 weeks ago by ironprogrammer (previous) (diff)

#6 @ironprogrammer
7 weeks ago

  • Keywords changes-requested removed
  • Milestone changed from Awaiting Review to 6.7

Updated report to reflect testing against trunk, so removing changes-requested for now. Also moving into the 6.7 milestone for consideration and more testing.

#7 @circlecube
4 weeks ago

I reproduced this issue on trunk using the MU plugin (linked above) to simulate an update failure.

Test Report

This report validates that the indicated patch addresses the issue.

Patch tested: https://core.trac.wordpress.org/attachment/ticket/61381/61381.diff

Environment

  • OS: macOS 14.6.1
  • Web Server: nginx/1.27.1
  • PHP: 8.2.23
  • WordPress: 6.7-alpha-58576-src
  • Browser: Chrome 128.0.6613.138
  • Theme: Twenty Twenty-One
  • Active Plugins:
    • None

Actual Results

  • ✅ Issue resolved with patch.

Additional Notes

Supplemental Artifacts

Here's the state before bulk updating plugins:
https://core.trac.wordpress.org/attachment/ticket/61381/01-bulk-plugins-updates.png

While bulk updating:
https://core.trac.wordpress.org/attachment/ticket/61381/02-bulk-plugins-update-in-process.png

The error state after first update fails:
https://core.trac.wordpress.org/attachment/ticket/61381/03-bulk-plugins-update-error.png

The js error in the error state:
https://core.trac.wordpress.org/attachment/ticket/61381/04-bulk-plugins-update-js-error.png

Then after applying the patch (and clearing cache) and running a bulk update again:
https://core.trac.wordpress.org/attachment/ticket/61381/05-bulk-plugins-updates-error-continues-with-patch.png
No JS error and after the first plugin update failed the updates continued and the bulk checkboxes deselected as expected.

This ticket was mentioned in Slack in #core-test by circlecube. View the logs.


4 weeks ago

#9 @jtsternberg
2 days ago

There are other places the plugin-information-footer comparison check is made followed by a call to wp.updates.setCardButtonStatus… Should this logic/handling be proactively added to those places as well? (e.g. in wp.updates.installPlugin, wp.updates.installPluginSuccess, wp.updates.checkPluginDependenciesSuccess, wp.updates.checkPluginDependenciesError, wp.updates.activatePluginSuccess, etc)

And if that's the case, maybe a more robust solution should be put in place? Just a thought.

#10 @jtsternberg
2 days ago

E.g. like maybe another method:

wp.updates.maybeSetCardButtonStatus = function( $element, data ) {
        if ( $element && $element.length && 'plugin-information-footer' === $element.attr( 'id' ) ) {
                wp.updates.setCardButtonStatus( data );
        }
};
Note: See TracTickets for help on using tickets.