Skip to:
Content
Pages
Categories
Search
Top
Bottom

Importing data via sql


  • Dirk1312
    Participant

    @dirk1312

    Hi all,

    I’d like to create new topics and posts from a former, self-developed forum. The data is available in a xml structure containing the following information:

    – parent post id (0 if its the topic initializing post itself)
    – author
    – subject
    – post
    – timestamp

    I now would like to insert the data via sql statements; all entries shall be added as anonymous posts. I can prepare them on my own, but I’ve no clue in which tables my posts have to be added. What I already did: Created a test forum, dumped the whole forum, added a new topic as anonymous user and again created a dump. Then I compared both dump files via notepad++. Now I’m not sure, which entries I really need.

    The following tables were extended:
    – bbpas
    – Counterize_Pages
    – options
    – popularpostsdata
    – popularpostssummary
    – postmeta
    – posts
    – statistics_pages
    – statistics_useronline (this is clear, that I don’t must extend this table manually?!)
    – statistics_visit (this is clear, that I don’t must extend this table manually?!)
    – statistics_visitor (this is clear, that I don’t must extend this table manually?!)
    – wfHits (I guess this is also some kind of statistics and must not be filled manually?!)

    Could you please help me? There should be no need to first lock the manually created entries and activate them as admin.

    Thanks and kind regards,

    Dirk

Viewing 11 replies - 1 through 11 (of 11 total)

  • Robin W
    Moderator

    @robin-w

    bbpress just uses

    posts
    post_meta
    and for its own settings
    options

    forums, topics and replies are all post types in wordpress.

    go to

    Import Forums

    for more info including an example importer.

    I documented my import from snitz access database when I very first started using bbpress, and you may want to read through that as well in this page

    Custom Import


    Dirk1312
    Participant

    @dirk1312

    Good morning Robin,

    thanks a lot! That reply was a big help.

    Kind regards,

    Dirk


    Robin W
    Moderator

    @robin-w

    great – glad to have helped 🙂


    Dirk1312
    Participant

    @dirk1312

    Is there a git repository or something like this where I can checkout your importer? I have no local wordpress installation and only want to see the source code.

    In general I (guess I) understood what needs to be inserted into the database comparing the pre- and post-topic-creation-dump, except the serialized array values for key “_bbp_akismet_as_submitted” in postmeta table. Are all the keys and information necessary? I don’t understand why the HOME key is needed related to an anonymous user or how I get the unique id for REDIRECT_REDIRECT_UNIQUE_ID,…
    With “are they necessary” I mean, for automatically / imported entries.

    Thanks and kind regards,

    Dirk


    Robin W
    Moderator

    @robin-w

    The file is :

    /bbpress/includes/admin/converters/Example.php

    so if you go to

    Download

    you can download it to your PC and open the file

    The source is available via browser at: https://bbpress.trac.wordpress.org/browser/trunk/src/includes/admin/converters

    Or SVN: https://bbpress.svn.wordpress.org/trunk

    Or Git: git://bbpress.git.wordpress.org/


    Dirk1312
    Participant

    @dirk1312

    Hi,

    I managed to parse the data from a exported xml file of a custom forum that doesn’t exist anymore. The data is now stored in the following database structure:

    table “authors”
    – column “id”
    – column “name”

    table “posts”
    – column “id”
    – column “parent_id”
    – column “author_id”
    – column “title”
    – column “post”
    – column “date”

    The former forum had a tree structure, so each entry in “posts” only knows its parent post and the forum topics have a “parent_id” 0.

    I tried to adapt the example.php importer but I don’t get it. Is it possible to import so structured data? Could you please help me to adapt the importer? If it helps, I can post my “custom” importer, but I think it’s wrong at all.

    Thanks and kind regards,

    Dirk


    Stephen Edgar
    Keymaster

    @netweb

    Sorry for the late reply Dirk, could you post your “custom” importer code to https://gist.github.com/ and I’ll take a look 🙂


    Dirk1312
    Participant

    @dirk1312

    Hi Stephen Edgar,

    I’m sorry for my late response. I still tried a little bit and enriched the data. Please find my importer here: https://gist.github.com/anonymous/9ad8e7c3dc4eecb34348d65da2da61a3

    I commented the values that are not available within the data. For the user passwords and salts I used some dummy values, since the users were not registered, but only guests.

    In the first lines of the reader I added the db table structure and below each table some comments, which are perhaps necessary to know.

    I appreciate your efforts and say “thank you” in advance!

    Kind regards, Dirk


    Dirk1312
    Participant

    @dirk1312

    Someone has any idea?

    Thanks and kind regards, Dirk


    kigazw
    Participant

    @kigazw

    Hello everybody!

    I am the owner of the forum in question. Dirk is so nice and wants to help me.

    I ask for help. It is about 10 years of knowledge and 16000 forum contributions that would otherwise be lost.

    Sorry for my bad english.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.
Skip to toolbar