WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#33637 closed defect (bug) (fixed)

Plugin updater ajax loader gif never get updated to show the success message.

Reported by: svovaf Owned by: adamsilverstein
Milestone: 4.6 Priority: normal
Severity: normal Version: 4.2.2
Component: Plugins Keywords: needs-patch shiny-updates
Focuses: ui, javascript, administration Cc:

Description

I'm a plugin developer and in my test environment I have multiple versions of my own plugin. They all located in different folders based on version number e.g. rating-widget.v.2.5.6.

The reason I have this setup is because I test upgrades from one version to another. So my use-case isn't esoteric.

When I click on the "update now" in /wp-admin/plugins.php I noticed that the ajax loader gif keep spinning forever. Even though the plugin's code is actually updated successfully.

I've done some debugging on the JS code and found an issue with:

b.updates.updateSuccess

The JS selector of the visual record of the updated plugin is based on slug:

(g = a('[data-slug="' + d.slug + '"]').first()

Without checking if the plugin is active or not. It could be easily fixed by changing the selector to:

(g = a('[data-slug="' + d.slug + '"].active').first()

I would submit the patch myself, but I never contributed to core so I'm not sure how to do it.

Change History (9)

#1 @adamsilverstein
4 years ago

  • Keywords needs-patch added
  • Owner set to adamsilverstein
  • Status changed from new to assigned

Hello @svovaf, thanks for your bug report. Your diagnosis of the issue is very helpful.

Submitting your first patch can be daunting (but worth it!), there is a bit to get set up on your end. This is a good place to start reading: https://make.wordpress.org/core/handbook/tutorials/working-with-patches/

I understand the issue you are seeing and have some questions. It does seem like an edge case to have several plugins with the same slug installed, still it should be doable to get this working.

Do you only have one version of the plugin active, and you are updating this version? Couldn't you be updating an inactive version of the plugin? Then your code wouldn't work if I understand what you are proposing (thats the .active selector, right)? I think an ideal solution would have the callback update the plugin you clicked update on, without regard to the slug (which is essentially the underlying issue you are raising here).

I can try to work up a patch for your issue or help you work one up if you want to give it a shot!

#2 follow-up: @svovaf
4 years ago

  • Yes, I only have one version of the plugin active at the time and I was trying to update the active version.
  • I didn't try to update inactive plugins.
  • I agree, updating the UI based on the clicked element would be the best. Since the JS looks uglified, it's kind of hard to work with it.

I'm happy to work up a patch, should I apply it on WP trunk? What's the SVN repo URL? Does everyone have permissions to patch it?

#3 @jorbin
4 years ago

Howdy svovaf, and welcome.

You can download the develop repository from https://develop.svn.wordpress.org/trunk/ (or if you prefer git, git://develop.git.wordpress.org/ ). This repository includes the core unit tests and build scripts and by default uses the unminified and unconcatenated javascript. Everyone has read privileges to these repos.

Once you have made the changes you wish to make, you can generate a patch file using the approriate git diff > 33637.patch or svn diff > 33637.patch. Then you can upload the patch here. Uploads don't trigger notifications, so please add the "has patch" workflow keyword and leave a comment after you have uploaded the patch.

#4 in reply to: ↑ 2 @adamsilverstein
4 years ago

Replying to svovaf:

  • Yes, I only have one version of the plugin active at the time and I was trying to update the active version.
  • I didn't try to update inactive plugins.
  • I agree, updating the UI based on the clicked element would be the best. Since the JS looks uglified, it's kind of hard to work with it.

I'm happy to work up a patch, should I apply it on WP trunk? What's the SVN repo URL? Does everyone have permissions to patch it?

In regard to the minified JS, you can add the following line to your wp-config.php file to use the source (unminified) JS:

define( 'SCRIPT_DEBUG', true );

Thanks for working on a patch!

Last edited 4 years ago by adamsilverstein (previous) (diff)

#5 @adamsilverstein
4 years ago

@svovaf Have you had a chance to work on a patch? If you have any questions, feel free to ping one of us on Slack.

Thanks!

#6 @adamsilverstein
4 years ago

We've been working on this issue for the new shiny updates plugin and have a new approach using the plugin name (path/filename) instead of the slug.

https://github.com/obenland/shiny-updates

#7 @adamsilverstein
4 years ago

  • Keywords shiny-updates added

#8 @obenland
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 37714:

Update/Install: Shiny Updates v2.

Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.

Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.

#9 @obenland
3 years ago

  • Milestone changed from Awaiting Review to 4.6
Note: See TracTickets for help on using tickets.