Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#29651 closed defect (bug) (fixed)

Network plugin menu update count displays even if there are 0 updates

Reported by: peterchester's profile peterchester Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.1 Priority: normal
Severity: minor Version: 4.1
Component: Networks and Sites Keywords: has-patch dev-feedback
Focuses: administration, multisite Cc:

Description

The network admin displays an update count for plugins even if there are no updates. This is because the conditional for updating plugins only checks for permissions and not if there are in fact updates to be applied.

To reproduce, install a multisite setup with up to date plugins and visit network admin. Note that there is a red "0" in the plugins menu.

Attachments (1)

29651.diff (1.9 KB) - added by peterchester 10 years ago.

Download all attachments as: .zip

Change History (7)

@peterchester
10 years ago

#1 @peterchester
10 years ago

  • Keywords has-patch dev-feedback added

#2 @peterchester
10 years ago

Note that the theme conditional only checked if there are updates to report and the plugins conditional only checked if you have the right to make updates. I've made them both check if there are updates AND if you have the right to make the updates. I'm not actually sure if it matters if you have the right. That's a policy decision. I figured I'd aim for consistency.

Also, note that the general total available updates doesn't care what you have the right to do. It only cares about how many updates to show. So even if you are not allowed to update plugins or themes, you'll still see the total update count.

#3 @SergeyBiryukov
10 years ago

  • Component changed from Upgrade/Install to Networks and Sites
  • Focuses multisite added
  • Milestone changed from Awaiting Review to 4.1

#4 @jeremyfelt
10 years ago

It's hard to tell, as the blame history gets a little confusing, but it appears that count-0 has been expected for quite a while. We have CSS applying display: none to any items in the menu with that class applied.

That said, this doesn't mean it's not a good change, especially because it's out of line with the behavior from the Theme updates already.

Do you have a custom color set applied? I'm unable to reproduce this locally. I get the element in the DOM, but it doesn't actually display.

#5 @peterchester
10 years ago

  • Severity changed from normal to minor

It turns out that I was seeing this because I was running a plugin that replaced the plugin updates array with nothing instead of an empty array. That is admittedly a flawed use case. On the other hand, it points to an actual inconsistency in the code that is rectified in this patch.

There might be another extreme (unusual) use case, but to be honest, I've moved on and forgotten what it was. In any case, it's pretty low priority but also pretty low risk.

#6 @wonderboymusic
10 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 29817:

Network Admin Menu:

  • Don't display update count for Themes when the user doesn't have the 'update_themes' cap
  • Don't display update count for Plugins when there aren't any/count is 0

Props peterchester.
Fixes #29651.

Note: See TracTickets for help on using tickets.