Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(minor) Plugin update count incorrect #64

Closed
Blindmikey opened this issue Jul 22, 2016 · 10 comments
Closed

(minor) Plugin update count incorrect #64

Blindmikey opened this issue Jul 22, 2016 · 10 comments

Comments

@Blindmikey
Copy link

It seems that this is causing the plugin update count on the menu items:

  • Dashboard->Updates
  • Plugins

To show 1 in a red circle, despite all plugins being up to date.

WP 4.5.3
Fresh install

@YahnisElsts
Copy link
Owner

I can't seem to reproduce that on my site. Are you sure it's not a configuration issue of some kind? Here are a few things to check:

  • If you explicitly specify the plugin slug when initialising the update checker, does the slug match the plugin directory name?
  • Is the plugin file name that's passed to the update checker the correct file?
  • Is the plugin installed in mu-plugins? WordPress doesn't support updates for mu-plugins, but it will still show the red 1 bubble when an update is available.

@YahnisElsts
Copy link
Owner

Any news on this?

@Blindmikey
Copy link
Author

I should have time to look further into this next week.

@YahnisElsts
Copy link
Owner

Did you get a chance to look into the update count issue?

@hallshouse
Copy link

hallshouse commented Feb 5, 2017

I'm having this issue as well, but also my sample plugin continues to show an update is available.
In my example, my plugin is version 1.0.1 and it says a version 1.0.1 update is available.

I'm not using a readme.txt file in the plugin folder, instead I'm only using the plugin-slug.json meta-data.

The sample plugin updates correctly and the plugin updated message displays, but when I refresh the browser, I get that an update is available from this version to this same version.

Any idea what the cause of this could be?

@YahnisElsts
Copy link
Owner

The sample plugin updates correctly and the plugin updated message displays, but when I refresh the browser, I get that an update is available from this version to this same version.

That's normal for the example plugin. The 2.0 "update" that it downloads is actually just another copy of version 1.1, so it will keep saying that an update is available. It's deliberately set up that way to make it easier to test update notifications.

I'm not using a readme.txt file in the plugin folder, instead I'm only using the plugin-slug.json meta-data.

That should be fine. The readme.txt will be completely ignored when you're using a JSON file.

In my example, my plugin is version 1.0.1 and it says a version 1.0.1 update is available.

Install Debug Bar and look at the "PUC (your-plugin-slug)" panel in the "Debug" menu. Does everything look right in the "Configuration" and "Status" sections? What's the content of the "Checked version" and "Cached update" fields?

@hallshouse
Copy link

Thanks for getting back @YahnisElsts
I have attached a file showing the Debug Bar results.
It all looks fine to me.
update_server_debug_results

@YahnisElsts
Copy link
Owner

I think I see the problem: the version number in the plugin header is "v1.0.2", but the version number in the JSON document is "1.0.2" (no "v" prefix). These numbers are not equal. Internally, the update checker uses the version_compare function to compare version numbers, and I suspect that this function will treat a version number that doesn't start with a digit as invalid.

Solution: remove the "v" prefix from the Version: v1.0.2 header.

@hallshouse
Copy link

Yup, that was it. Thanks very much @YahnisElsts

@YahnisElsts
Copy link
Owner

All right, that's good to hear.

Since the original reporter hasn't responded in 5+ months, I'll go ahead and assume they've got it fixed as well, and close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants