Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-07-2011, 04:21 AM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help importing WordPress tables into vB tables?

I am working on merging/importing WordPress content into vB 4.1.8. Since the WordPress version is not one supported by Impex, I am having to import a lot of the content manually. Impex did allow me to import all of the user data and part of the WP posts data, but some of it would not transfer over.

In particular, I am attempting to copy over the WP post_date into vB dateline columns. I have noticed that the format for the dates is different. In vB, the dates look something like this "1311841061" and in WP they look like this "2011-07-14 04:35:36". Does anyone know how I can correctly convert that so it copies over in the correct format?

Thanks!

--------------- Added [DATE]1323235634[/DATE] at [TIME]1323235634[/TIME] ---------------

Also, does anyone have any advice for me as I am doing this merge manually without Impex for the first time? I haven't been able to find any mods, instructions, or anything that do this with vB 4.x. so I am winging it.
Reply With Quote
  #2  
Old 12-08-2011, 01:24 AM
Bob Meta Bob Meta is offline
 
Join Date: Jul 2010
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I find this site to be very useful for converting dates to unix timestamps: http://www.epochconverter.com/. Hope this helps!
Reply With Quote
  #3  
Old 12-08-2011, 02:25 AM
LifesGreatestGift's Avatar
LifesGreatestGift LifesGreatestGift is offline
 
Join Date: Jul 2009
Location: Louisville, KY USA
Posts: 885
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this may be a good guide for converting the table/column to the proper time format. (in phpmyadmin or something similar)

http://stackoverflow.com/questions/1...mysql-datetime

remember to backup before modifying.
Reply With Quote
  #4  
Old 12-09-2011, 05:54 AM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Awesome! I will check out those links. Thanks!!
Reply With Quote
  #5  
Old 01-08-2012, 07:02 AM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

After much research and trial and error, I find myself a bit frustrated. I am on the right path, but can't get the queries quite right. Any assistance would be greatly appreciated.

I know I need to convert the database field type DATETIME to UNIXTIME. I figured out how to display the whole field in UNIXTIME with the query below, but it does not permanently convert or save it.

Code:
SELECT UNIX_TIMESTAMP(`post_date`) FROM `wp_posts`
I also tried this (total experiment... don't laugh ) with no luck...

Code:
ALTER TABLE `wp_posts` CHANGE `post_date` `post_date_old` int(11) NOT NULL
ALTER TABLE `wp_posts` ADD `post_date` UNIXTIME NOT NULL
UPDATE `wp_posts` SET `post_date`=FROM_DATETIME(post_date_old)
Reply With Quote
  #6  
Old 01-08-2012, 02:47 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by AFemaleProdigy View Post
Code:
ALTER TABLE `wp_posts` CHANGE `post_date` `post_date_old` int(11) NOT NULL
ALTER TABLE `wp_posts` ADD `post_date` UNIXTIME NOT NULL
UPDATE `wp_posts` SET `post_date`=FROM_DATETIME(post_date_old)

I think I would have tried something like this - what happened when you tried?
Reply With Quote
  #7  
Old 01-08-2012, 05:23 PM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I get this error...

Code:
Error

SQL query: 

ALTER TABLE `wp_posts` CHANGE `post_date` `post_date_old` int( 11 ) NOT NULL ALTER TABLE `wp_posts` ADD `post_date` UNIXTIME NOT NULL UPDATE `wp_posts` SET `post_date` = FROM_DATETIME( post_date_old
) 
MySQL said:  
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE `wp_posts` ADD `post_date` UNIXTIME NOT NULL
UPDATE `wp_posts` SET ' at line 2
Reply With Quote
  #8  
Old 01-08-2012, 05:29 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Those are three separate queries, so they need to be executes separately. I think the error's saying it got confused when it reached the second query.
Reply With Quote
  #9  
Old 01-08-2012, 06:34 PM
AFemaleProdigy's Avatar
AFemaleProdigy AFemaleProdigy is offline
 
Join Date: Mar 2006
Location: Murrells Inlet, SC
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The first line executes properly. The second line didn't work.
Reply With Quote
  #10  
Old 01-08-2012, 06:48 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh...oops, should have noticed that. I guess there is no "UNIXTIME" type, so you just want it to be int(10) .
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:37 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04234 seconds
  • Memory Usage 2,252KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete