[wp-trac] [WordPress Trac] #27565: Recent Posts Widget should include scheme in cache key

WordPress Trac noreply at wordpress.org
Thu Aug 20 05:02:27 UTC 2015


#27565: Recent Posts Widget should include scheme in cache key
--------------------------+-----------------------
 Reporter:  dllh          |       Owner:  obenland
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  4.4
Component:  Widgets       |     Version:  2.8
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+-----------------------
Changes (by westonruter):

 * keywords:  has-patch commit => has-patch


Comment:

 Replying to [comment:6 obenland]:
 > Refreshed westi's patch. Can anyone see anything wrong with it?

 What about the situation where the site can be accessed via multiple
 domains? For instance, if setting the `WP_HOME` constant to include
 `$_SERVER['HTTP_HOST']`, then the cached values could be wrong.

 So what if instead of using `is_ssl() ? 'https' : 'http'` in the cache
 key, it instead uses `home_url()`?

 This would necessarily change how the cache deletion is done, since it
 wouldn't be known all of the possible home URLs that could appear. So the
 cached value could instead be an array of cached outputs mapped to the
 `home_url` that was active for that given cache. In that way, you can
 still just delete one cache value and it will purge the caches for all
 variations of the home URL.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27565#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list