Ticket #3034 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Livejournal import adjusts time incorrectly for posts, but not comments

Reported by: dustyakubra Assigned to: rob1n
Priority: normal Milestone: 2.3
Component: Administration Version: 2.0.4
Severity: normal Keywords: has-patch
Cc:

Description

The livejournal import uses gmdate() on post times but date() on comment times. For me, my server configuration made all the posts appear to be 4 hours later, although the comments appeared to be at the right time.

Here's the code for importing post times:

preg_match('|<eventtime>(.*?)</eventtime>|is', $post, $post_date);
$post_date = strtotime($post_date[1]);
$post_date = gmdate('Y-m-d H:i:s', $post_date);

And for comments:

preg_match('|<eventtime>(.*?)</eventtime>|is', $comment, $comment_date);
$comment_date = trim($comment_date[1]);
$comment_date = date('Y-m-d H:i:s', strtotime($comment_date));

It seems silly to do this two different ways. For my configuration, I simply changed the code for importing post times to:

preg_match('|<eventtime>(.*?)</eventtime>|is', $post, $post_date);
$post_date = trim($post_date[1]);
$post_date = date('Y-m-d H:i:s', strtotime($post_date));

Looking at it, the trim() doesn't seem necessary either, as there was nothing to trim on my <eventtime>s for either the posts or the comments.

By the way, it seems to me that livejournal's export feature doesn't even allow the exporting of comments (and their associated metadata.) I personally downloaded my livejournal using ljarchive which AFAIK doesn't edit the xml at all.. but yeah.

Also, I'm not sure which component this belongs in - is there a page describing the components? (similar to bugzilla's describecomponents.cgi) .. you see, is Administration about the admin control panel for wordpress, or is it about general administration elements of the wordpress project? *puzzled*

Attachments

3034.diff (0.6 kB) - added by rob1n on 04/26/07 03:27:06.

Change History

02/28/07 21:51:59 changed by foolswisdom

  • milestone set to 2.3.

04/25/07 02:37:50 changed by rob1n

  • owner changed from anonymous to rob1n.

04/26/07 03:27:06 changed by rob1n

  • attachment 3034.diff added.

04/26/07 03:32:10 changed by rob1n

  • keywords changed from import, livejounnal, timezone, to has-patch.
  • priority changed from low to normal.
  • severity changed from minor to normal.

04/26/07 03:33:42 changed by rob1n

  • status changed from new to assigned.

04/27/07 00:56:12 changed by rob1n

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [5326]) Use non-GMT date. fixes #3034