WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 5 weeks ago

#32804 closed defect (bug) (fixed)

Dashboard feeds when switching language

Reported by: andg Owned by: johnbillion
Milestone: 4.3 Priority: normal
Severity: normal Version: 2.5
Component: Administration Keywords: has-patch
Focuses: administration Cc:

Description

This might not be the most relevant thing to cover, since language selection is now done at the beginning of the installation process, but when you switch from one language to another, dashboard News feeds should be refreshed in order to show localized content, and allow for the translation of the "Popular Plugin" string, without waiting for the transient to expire.

Attachments (2)

patch.diff (573 bytes) - added by andg 2 years ago.
That makes sense, as the feeds cached with the old key would automatically be updated with the new one with the new key, without the user noticing.
32804.diff (534 bytes) - added by andg 2 years ago.
This is a new version of the patch with the solution proposed by @ocean90 to include the locale inside the md5 call.

Download all attachments as: .zip

Change History (14)

#1 @ocean90
2 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

Hello andg, welcome to Trac!

Thanks for your valid report.
The feed gets cached in wp_dashboard_cached_rss_widget() The current cache key in wp_dashboard_cached_rss_widget() is 'dash_' . md5( $widget_id ). I think we should change the cache key to include the current locale.
For the credits we're using 'wordpress_credits_' . $locale so we could change the key to 'dash_' . md5( $widget_id ) . '_' . $locale.

@andg
2 years ago

That makes sense, as the feeds cached with the old key would automatically be updated with the new one with the new key, without the user noticing.

#2 @andg
2 years ago

  • Keywords has-patch added; needs-patch removed

#3 @johnbillion
2 years ago

  • Component changed from Feeds to Administration
  • Milestone changed from Future Release to 4.3
  • Version changed from 4.2.2 to 2.5

#4 @johnbillion
2 years ago

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

In 33183:

Append the current locale to dashboard RSS widget cache keys so they refresh accordingly when the locale is changed.

Fixes #32804
Props andg

#5 @dd32
2 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

As the maximum length of an expiring transient name is 45 characters, this will cause issue for any site which has their locale set to anything longer than 8 characters (45 - 5 (dash_) - 32 (md5) = 8)

Although most locale's are 5~6 characters max, there's things like de_DE_formal and 58 other locale variants that are showing up in the WordPress.org stats which are longer than 8 characters.

#6 @andg
2 years ago

Thanks @dd32. So, this solution ain't gonna work. Perhaps we could simply leave the transient name as it is right now, track when language switching happens and manually trigger a Dashboard feed refresh by deleting that transient. Is that possible?

#7 @ocean90
2 years ago

We can move the locale inside md5().

@andg
2 years ago

This is a new version of the patch with the solution proposed by @ocean90 to include the locale inside the md5 call.

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


2 years ago

#9 follow-up: @johnbillion
2 years ago

Ugh, I considered the length of the transient key but not the transient timeout key. My bad.

32804.diff makes sense.

#10 in reply to: ↑ 9 @dd32
2 years ago

32804.diff makes sense.

Seems fine to me too.

#11 @johnbillion
2 years ago

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

In 33192:

Place the locale inside the md5 hash in the dashboard RSS feed widget transient key to prevent the transient timeout option name becoming longer than the allowed field size.

Props andg
Fixes #32804

#12 @SergeyBiryukov
5 weeks ago

In 40802:

Dashboard: Append the current locale to dashboard RSS widget cache key in wp_dashboard_rss_control(), for consistency with the changes to wp_dashboard_cached_rss_widget() in [33183] and [33192].

See #32804, #40702.

Note: See TracTickets for help on using tickets.