Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#3034 closed defect (bug) (fixed)

Livejournal import adjusts time incorrectly for posts, but not comments

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


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 (1)

3034.diff (603 bytes) - added by rob1n 9 years ago.

Download all attachments as: .zip

Change History (6)

#1 @foolswisdom
9 years ago

  • Milestone set to 2.3

#2 @rob1n
9 years ago

  • Owner changed from anonymous to rob1n

9 years ago

#3 @rob1n
9 years ago

  • Keywords has-patch added; import livejounnal timezone removed
  • Priority changed from low to normal
  • Severity changed from minor to normal

#4 @rob1n
9 years ago

  • Status changed from new to assigned

#5 @rob1n
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

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

Note: See TracTickets for help on using tickets.