Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#53710 closed defect (bug) (fixed)

WP Update notice shown twice

Reported by: presskopp's profile Presskopp Owned by: audrasjb's profile audrasjb
Milestone: 5.9 Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords: has-screenshots has-patch commit
Focuses: Cc:

Description

On updates (wp-admin/update-core.php) the message to update manually to a new localised version is shown twice.

Expected behaviour would be to show the message only once and then also show a message about the possibility to update to the US version manually.

Original phrase:
"You can update from WordPress %1$s to <a href="%2$s">WordPress %3$s</a> manually:"

Attachments (5)

570571.png (10.8 KB) - added by Presskopp 4 years ago.
572580.png (26.1 KB) - added by Presskopp 4 years ago.
53710.diff (571 bytes) - added by benjamingosset 3 years ago.
updates-before.png (35.2 KB) - added by benjamingosset 3 years ago.
Before patch
updates-after.png (35.5 KB) - added by benjamingosset 3 years ago.
After patch

Download all attachments as: .zip

Change History (13)

@Presskopp
4 years ago

@Presskopp
4 years ago

#1 @audrasjb
4 years ago

  • Component changed from Administration to Upgrade/Install
  • Milestone changed from Awaiting Review to 5.9
  • Owner set to audrasjb
  • Status changed from new to accepted

Good point.

I suspect this is because the list_core_update() function is called two times, inside a foreach loop.

https://build.trac.wordpress.org/browser/trunk/wp-admin/update-core.php?marks=140#L222

@benjamingosset
3 years ago

#2 @benjamingosset
3 years ago

  • Keywords has-patch added; needs-patch removed

Hi,

After taking a look to the list_core_update() function pointed by @audrasjb , it seems that the if statement on line 43 fails when $update->locale is 'en_US' and get_locale() is different than 'en_US'. By the way, update button has the correct locale, only the message is wrong.

I add an elseif statement (which works too with a else statement) to set $version_string working for a non-en_US locale when displaying 'en_US' update.

Could someone check if everything is ok ?

Thanks

@benjamingosset
3 years ago

Before patch

@benjamingosset
3 years ago

After patch

#3 @audrasjb
3 years ago

  • Keywords commit added

I tested the patch and it fixes the issue. Thanks @benjamingosset I'm marking this as ready for commit.

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


3 years ago

This ticket was mentioned in Slack in #core-auto-updates by afragen. View the logs.


3 years ago

#6 @audrasjb
3 years ago

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

In 52197:

Upgrade/Install: Differentiate en_US version strings from localized ones.

Adds a condition to $version_string to determine whether the Core update is the original en_US package, or a localized one.

This change fixes an issue where these packages were not differentiated and duplicate messages were displayed.

Props Presskopp, benjamingosset.
Fixes #53710.

#7 follow-up: @audrasjb
3 years ago

Committed to WP 5.9. Thanks @benjamingosset for the patch!

#8 in reply to: ↑ 7 @benjamingosset
3 years ago

Replying to audrasjb:

Committed to WP 5.9. Thanks @benjamingosset for the patch!

Nice ! Thanks for the commit @audrasjb !

Note: See TracTickets for help on using tickets.