Moodle

RSS pubDate format is incorrect

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.8
  • Fix Version/s: 1.8.7, 1.9.3, 2.0
  • Component/s: RSS
  • Labels:
    None
  • Database:
    Any
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

Description

In the Moodle RSS, the zone format of pubDate is incorrect
outside North America. If the time zone is set to JST (Japan
Standard Time), say, pubDate shows the JST time.

RFC822 (obsolete) states:

zone = "UT" / "GMT" ; Universal Time
; North American : UT
/ "EST" / "EDT" ; Eastern: - 5/ - 4
/ "CST" / "CDT" ; Central: - 6/ - 5
/ "MST" / "MDT" ; Mountain: - 7/ - 6
/ "PST" / "PDT" ; Pacific: - 8/ - 7
/ 1ALPHA ; Military: Z = UT;
; A:-1; (J not used)
; M:-12; N:+1; Y:+12
/ ( ("+" / "-") 4DIGIT ) ; Local differential
; hours+min. (HHMM)

and RFC2822 (which obsoletes RFC822) states:

zone = (( "+" / "-" ) 4DIGIT) / obs-zone

At any rate JST must not be used; GMT may be used, but the
RFC2822 form is preferable.

Activity

Hide
Sean Keogh added a comment -

Can someone look at this please?

We have a client here in the UK using RSS feeds, and they have also noticed that the RSS Feed pubdate is in incorrect format - if you try and validate the feed using (for example) the W3C rss feed validator, it complains:

line 20, column 44: pubDate must be an RFC-822 date-time: Tue, 16 Sep 2008 09:23:22 BST

The help attached to it states:

Message

element must be an RFC-822 date-time
Explanation

Invalid date-time. The value specified must meet the Date and Time specifications as defined by RFC822, with the exception that the year should be expressed as four digits.
Solution

Change the date-time format to comply with RFC822. Here are examples of valid RFC822 date-times:

<pubDate>Wed, 02 Oct 2002 08:00:00 EST</pubDate>

<pubDate>Wed, 02 Oct 2002 13:00:00 GMT</pubDate>

<pubDate>Wed, 02 Oct 2002 15:00:00 +0200</pubDate>

Common errors include localizing the month name or the days of the week, not using the exact abbreviation provided by the specification, or attempting to use a time zone name that is not listed. See Section 5.1 for the list of allowable values for these portions of the date.

Here is an example of an invalid RFC822 date-time. This is commonly seen in RSS 1.0 feeds generated by older versions of Movable Type:

<pubDate>2002-10-02T08:00:00-05:00</pubDate>

So presumably it does not like the BST?

This is fairly urgent.

Sean K

Show
Sean Keogh added a comment - Can someone look at this please? We have a client here in the UK using RSS feeds, and they have also noticed that the RSS Feed pubdate is in incorrect format - if you try and validate the feed using (for example) the W3C rss feed validator, it complains: line 20, column 44: pubDate must be an RFC-822 date-time: Tue, 16 Sep 2008 09:23:22 BST The help attached to it states: Message element must be an RFC-822 date-time Explanation Invalid date-time. The value specified must meet the Date and Time specifications as defined by RFC822, with the exception that the year should be expressed as four digits. Solution Change the date-time format to comply with RFC822. Here are examples of valid RFC822 date-times: <pubDate>Wed, 02 Oct 2002 08:00:00 EST</pubDate> <pubDate>Wed, 02 Oct 2002 13:00:00 GMT</pubDate> <pubDate>Wed, 02 Oct 2002 15:00:00 +0200</pubDate> Common errors include localizing the month name or the days of the week, not using the exact abbreviation provided by the specification, or attempting to use a time zone name that is not listed. See Section 5.1 for the list of allowable values for these portions of the date. Here is an example of an invalid RFC822 date-time. This is commonly seen in RSS 1.0 feeds generated by older versions of Movable Type: <pubDate>2002-10-02T08:00:00-05:00</pubDate> So presumably it does not like the BST? This is fairly urgent. Sean K
Hide
Martin Dougiamas added a comment -

Hmm, I'm pretty sure we USED to validate .... did the validators change?

Donsheng, when you need a little break from repositories, can you fix these dates?

Look for the rss_add_items() function in lib/rsslib.php ... this line explicitly sets the date that way:

$result .= rss_full_tag('pubDate',3,false,date('D, d M Y H:i:s T',$item->pubdate));

Show
Martin Dougiamas added a comment - Hmm, I'm pretty sure we USED to validate .... did the validators change? Donsheng, when you need a little break from repositories, can you fix these dates? Look for the rss_add_items() function in lib/rsslib.php ... this line explicitly sets the date that way: $result .= rss_full_tag('pubDate',3,false,date('D, d M Y H:i:s T',$item->pubdate));
Hide
Martin Dougiamas added a comment -

DS, you probably just want to make it show GMT all the time there.

Show
Martin Dougiamas added a comment - DS, you probably just want to make it show GMT all the time there.
Hide
Martin Dougiamas added a comment -

Actually I'll just fix it, since I'm there

Show
Martin Dougiamas added a comment - Actually I'll just fix it, since I'm there
Hide
Martin Dougiamas added a comment -

I've made it GMT all the time now, working fine for me.

Show
Martin Dougiamas added a comment - I've made it GMT all the time now, working fine for me.
Hide
Sean Keogh added a comment -

HI MArtin,

Thanks - I'll grab a copy of the relevant script from the public CVS - how long does it take for your changes to get across to there?

Sean K

Show
Sean Keogh added a comment - HI MArtin, Thanks - I'll grab a copy of the relevant script from the public CVS - how long does it take for your changes to get across to there? Sean K
Hide
Martin Dougiamas added a comment -

You can see the change here on this bug: http://tracker.moodle.org/browse/MDL-12563?page=com.atlassian.jira.plugin.system.issuetabpanels:cvs-tabpanel

And it'll be in tomorrow's weekly builds.

And it's probably in CVS mirrors by now too.

Show
Martin Dougiamas added a comment - You can see the change here on this bug: http://tracker.moodle.org/browse/MDL-12563?page=com.atlassian.jira.plugin.system.issuetabpanels:cvs-tabpanel And it'll be in tomorrow's weekly builds. And it's probably in CVS mirrors by now too.
Hide
Martin Dougiamas added a comment -

Note, to regenerate all the RSS feeds, delete all the files from dataroot/rss/* and the re-run cron.php manually.

Show
Martin Dougiamas added a comment - Note, to regenerate all the RSS feeds, delete all the files from dataroot/rss/* and the re-run cron.php manually.
Hide
Sean Keogh added a comment -

Hi,

Client has just reported that now their feeds are broken:

http://www.jbevirtualtraining.co.uk/dev3d/rss/file.php/4/2/data/1/rss.xml

shows the following:

JBE Virtual Training http://www.jbevirtualtraining.co.uk/dev3d <div style="text-align: center;"><font size="2">This is a new Moodle site for JBE Virtual Training<br /><font size="1">Running Moodle version 1.9.2</font></font><br /> </div> Moodle © 2008 JBE Virtual Training http://www.jbevirtualtraining.co.uk/dev3d/theme/chameleon-jbe/pix/i/rsssitelogo.gif moodle http://www.jbevirtualtraining.co.uk/dev3d 140 35 RSS Error http://www.jbevirtualtraining.co.uk/dev3d Wed, 17 Sep 2008 08:30:49 GMT Error reading RSS data http://www.jbevirtualtraining.co.uk/dev3d

Also, neither of their sites (live or dev) have an rss directory under dataroot.

Sean K

Show
Sean Keogh added a comment - Hi, Client has just reported that now their feeds are broken: http://www.jbevirtualtraining.co.uk/dev3d/rss/file.php/4/2/data/1/rss.xml shows the following: JBE Virtual Training http://www.jbevirtualtraining.co.uk/dev3d <div style="text-align: center;"><font size="2">This is a new Moodle site for JBE Virtual Training<br /><font size="1">Running Moodle version 1.9.2</font></font><br /> </div> Moodle © 2008 JBE Virtual Training http://www.jbevirtualtraining.co.uk/dev3d/theme/chameleon-jbe/pix/i/rsssitelogo.gif moodle http://www.jbevirtualtraining.co.uk/dev3d 140 35 RSS Error http://www.jbevirtualtraining.co.uk/dev3d Wed, 17 Sep 2008 08:30:49 GMT Error reading RSS data http://www.jbevirtualtraining.co.uk/dev3d Also, neither of their sites (live or dev) have an rss directory under dataroot. Sean K
Hide
Martin Dougiamas added a comment -

Then I would suspect no one has run cron yet ...

Show
Martin Dougiamas added a comment - Then I would suspect no one has run cron yet ...
Hide
Sean Keogh added a comment -

HI Martin,

Cron is set to run every 15 minutes on both of their sites.

It is definitely running

Any ideas?

Sean K

Show
Sean Keogh added a comment - HI Martin, Cron is set to run every 15 minutes on both of their sites. It is definitely running Any ideas? Sean K
Hide
Martin Dougiamas added a comment -

Try running it manually via web (turn off the cron security first so you can) and see if you see errors.

I'm pretty sure it's not related to the change I made.

Show
Martin Dougiamas added a comment - Try running it manually via web (turn off the cron security first so you can) and see if you see errors. I'm pretty sure it's not related to the change I made.
Hide
Sean Keogh added a comment -

Ok, just done so - no errors reported in the cron output (see below).

Server Time: Thu, 18 Sep 2008 13:37:31 +0100

Starting activity modules
Processing module function assignment_cron ...done.
Processing module function forum_cron ...Starting digest processing...
Cleaned old digest records
done.
Finished activity modules
Starting blocks
Processing cron function for search....Global searching is not enabled. Nothing performed by search.
done.
Finished blocks
Starting admin reports
Finished admin reports
Updating languages cache
Removing expired enrolments ...none found
Starting main gradebook job ...
done.
Running backups if required...
Checking backup status...INACTIVE
Backup tasks finished.
Running rssfeeds if required...
Generating rssfeeds...
assignment: ...NOT SUPPORTED (file)
chat: ...NOT SUPPORTED (file)
choice: ...NOT SUPPORTED (file)
data: generating Creating feed for Tutors DB; Screens
...OK
exercise: ...NOT SUPPORTED (file)
forum: generating ...OK
glossary: generating ...OK
hotpot: ...NOT SUPPORTED (file)
journal: ...NOT SUPPORTED (file)
label: ...NOT SUPPORTED (file)
lams: ...NOT SUPPORTED (file)
lesson: ...NOT SUPPORTED (file)
quiz: ...NOT SUPPORTED (file)
resource: ...NOT SUPPORTED (file)
scorm: ...NOT SUPPORTED (file)
survey: ...NOT SUPPORTED (file)
wiki: ...NOT SUPPORTED (file)
workshop: ...NOT SUPPORTED (file)
questionnaire: ...NOT SUPPORTED (file)
Ending rssfeeds......OK
Rssfeeds finished
Running auth crons if required...
Running stats cleanup tasks...
...stats cleanup finished
Cron script completed correctly
Execution took 1.054058 seconds

And now, when I check that feed, it looks OK to me - no errors.

Why would running it manually be different to running it scheduled?

cheers

Sean K

Show
Sean Keogh added a comment - Ok, just done so - no errors reported in the cron output (see below). Server Time: Thu, 18 Sep 2008 13:37:31 +0100 Starting activity modules Processing module function assignment_cron ...done. Processing module function forum_cron ...Starting digest processing... Cleaned old digest records done. Finished activity modules Starting blocks Processing cron function for search....Global searching is not enabled. Nothing performed by search. done. Finished blocks Starting admin reports Finished admin reports Updating languages cache Removing expired enrolments ...none found Starting main gradebook job ... done. Running backups if required... Checking backup status...INACTIVE Backup tasks finished. Running rssfeeds if required... Generating rssfeeds... assignment: ...NOT SUPPORTED (file) chat: ...NOT SUPPORTED (file) choice: ...NOT SUPPORTED (file) data: generating Creating feed for Tutors DB; Screens ...OK exercise: ...NOT SUPPORTED (file) forum: generating ...OK glossary: generating ...OK hotpot: ...NOT SUPPORTED (file) journal: ...NOT SUPPORTED (file) label: ...NOT SUPPORTED (file) lams: ...NOT SUPPORTED (file) lesson: ...NOT SUPPORTED (file) quiz: ...NOT SUPPORTED (file) resource: ...NOT SUPPORTED (file) scorm: ...NOT SUPPORTED (file) survey: ...NOT SUPPORTED (file) wiki: ...NOT SUPPORTED (file) workshop: ...NOT SUPPORTED (file) questionnaire: ...NOT SUPPORTED (file) Ending rssfeeds......OK Rssfeeds finished Running auth crons if required... Running stats cleanup tasks... ...stats cleanup finished Cron script completed correctly Execution took 1.054058 seconds And now, when I check that feed, it looks OK to me - no errors. Why would running it manually be different to running it scheduled? cheers Sean K
Hide
Petr Škoda (skodak) added a comment -

code change reviewed, this could not cause any regressions
thanks

Show
Petr Škoda (skodak) added a comment - code change reviewed, this could not cause any regressions thanks
Hide
Chris Fryer added a comment -

The other way around it, if you wanted to retain local times, would be to use the timezone offset. So

$result .= rss_full_tag('pubDate',3,false,date('D, d M Y H:i:s T',$item->pubdate));

becomes

$result .= rss_full_tag('pubDate',3,false,date('D, d M Y H:i:s O',$item->pubdate));

The "O" in date() will give you +0000 for GMT, -0500 for EST, etc.

Show
Chris Fryer added a comment - The other way around it, if you wanted to retain local times, would be to use the timezone offset. So $result .= rss_full_tag('pubDate',3,false,date('D, d M Y H:i:s T',$item->pubdate)); becomes $result .= rss_full_tag('pubDate',3,false,date('D, d M Y H:i:s O',$item->pubdate)); The "O" in date() will give you +0000 for GMT, -0500 for EST, etc.

Dates

  • Created:
    Updated:
    Resolved: