Issue Details (XML | Word | Printable)

Key: MDL-12563
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Martin Dougiamas
Reporter: Haruhiko Okumura
Votes: 1
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

RSS pubDate format is incorrect

Created: 13/Dec/07 12:51 PM   Updated: 05/Dec/08 09:43 PM
Component/s: RSS
Affects Version/s: 1.8
Fix Version/s: 1.8.7, 1.9.3, 2.0

Database: Any
Participants: Chris Fryer, Haruhiko Okumura, Martin Dougiamas, Petr Skoda (frankenstein) and Sean Keogh
Security Level: None
QA Assignee: Petr Skoda (frankenstein)
Resolved date: 16/Sep/08
Affected Branches: MOODLE_18_STABLE
Fixed Branches: MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE


 Description  « Hide
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.



 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Sean Keogh added a comment - 16/Sep/08 04:30 PM
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


Martin Dougiamas added a comment - 16/Sep/08 04:42 PM
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));


Martin Dougiamas added a comment - 16/Sep/08 04:44 PM
DS, you probably just want to make it show GMT all the time there.

Martin Dougiamas added a comment - 16/Sep/08 04:46 PM
Actually I'll just fix it, since I'm there

Martin Dougiamas added a comment - 16/Sep/08 04:59 PM
I've made it GMT all the time now, working fine for me.

Sean Keogh added a comment - 16/Sep/08 05:25 PM
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


Martin Dougiamas added a comment - 16/Sep/08 05:35 PM
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.


Martin Dougiamas added a comment - 16/Sep/08 05:37 PM
Note, to regenerate all the RSS feeds, delete all the files from dataroot/rss/* and the re-run cron.php manually.

Sean Keogh added a comment - 17/Sep/08 04:45 PM
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


Martin Dougiamas added a comment - 17/Sep/08 04:58 PM
Then I would suspect no one has run cron yet ...

Sean Keogh added a comment - 18/Sep/08 04:36 PM
HI Martin,

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

It is definitely running

Any ideas?

Sean K


Martin Dougiamas added a comment - 18/Sep/08 07:35 PM
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.


Sean Keogh added a comment - 18/Sep/08 08:40 PM
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


Petr Skoda (frankenstein) added a comment - 24/Sep/08 04:41 AM
code change reviewed, this could not cause any regressions
thanks

Chris Fryer added a comment - 05/Dec/08 09:43 PM
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.