Opened 18 years ago
Closed 17 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: |
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*
(In [5326]) Use non-GMT date. fixes #3034