WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#3950 closed enhancement (wontfix)

enhance fetch_rss to optionally have a variable cache timeout

Reported by: DD32 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.2
Component: General Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description

Issue: Plugin developers want to check a RSS feed only once per day.

Current Solution: Define MAGPIE_CACHE_AGE to the timeout value before retrieving RSS feed.

Issues with that solution: If multiple plugins want to use different timeouts, its impossible, Only the first item that uses fetch_rss may specify a timeout.

More Elegant solution: Allow fetch_rss() to accept a cache timeout: fetch_rss($rssFeedUrl,24*60*60)

Other Notes:
Patch attached to make this possible, At present All RSS feeds are cached for 1hour, unless MAGPIE_CACHE_AGE is set beforehand.
This also allows developers to disable the RSS cache by specifying a timeout value of 0 seconds. This is not aimed at plugin developers, but mainly towards developers working on any Administration issues which may require constant RSS updates.

Attachments (2)

3950.fetch-rss-timeout-addition.patch (1023 bytes) - added by DD32 7 years ago.
fetch_rss add $timeout
3950.fetch-rss-timeout-addition-2.patch (3.6 KB) - added by DD32 7 years ago.

Download all attachments as: .zip

Change History (9)

DD327 years ago

fetch_rss add $timeout

comment:1 DD327 years ago

  • Keywords 2nd-opinion added

Alternate patch added which adds the function

fetch_rss_timeout ($url, $timeout = false )

Designed in mind to allow easier backwards compatibility, Also to allow plugin authors to check if the WordPress install supports the timeout option or not ( if (function_exists('fetch_rss_timeout'))..

comment:2 foolswisdom7 years ago

  • Milestone changed from 2.2 to 2.3

comment:3 ryan7 years ago

  • Milestone changed from 2.3 to 2.4

comment:4 ffemtcj6 years ago

  • Milestone changed from 2.5 to 2.6

comment:5 DD326 years ago

I'm tempted to close as wontfix, It doesnt appear to have much traction from others, and storing an option instead works just as well.

Alternativly, You can manually create a RSSCache object and set custom timeouts that way, fetch_rss should pick up those custom RSSCache objects AFAIK. (I believe, i've not attempted this, but plan to for a plugin)

comment:6 DD326 years ago

  • Cc dd32 removed
  • Resolution set to wontfix
  • Status changed from new to closed

Yep, closing as wontfix, if anyone else comes along with a need too, reopen.

comment:7 lloydbudd6 years ago

  • Milestone 2.6 deleted
Note: See TracTickets for help on using tickets.