1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Manual Insert Posts - Schema

Discussion in 'Installation, Upgrade, and Import Support' started by Rizwan Kassim, Feb 12, 2013.

  1. Rizwan Kassim

    Rizwan Kassim Member

    I'd like to import some posts from my listserv/mailman archive.

    Is there a simple API call I could make, or a list of INSERTS required so that we can parse our logs and insert our old data?

    Thanks,
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You need to insert into the xf_thread and xf_post tables.

    If you can get the source data into separate tables in your XF database then you can do cross table inserts, like this:

    Code:
    INSERT INTO xf_thread (thread_id, node_id, title, user_id, username, post_date, first_post_id, last_post_date, last_post_id, last_post_user_id, last_post_username)
    	SELECT values, for, each, column
    	FROM yourtable;
    
    INSERT INTO xf_post (thread_id, user_id, username, post_date, message, position, like_users)
    	SELECT values, for, each, column
    	FROM yourtable;
    
    Then rebuild your thread information afterwards:

    Admin CP -> Tools -> Rebuild Caches
     
  3. Rizwan Kassim

    Rizwan Kassim Member

    Thanks!
    What about attachments?
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Attachment data is more complex. You can no longer use simple queries. I suggest creating a new importer so you can use the import model. You can refer to the built-in importers for reference:

    library/XenForo/Importer
     

Share This Page