WordPress.org

Ready to get started?Download WordPress

Forums

Convert Twice (3 posts)

  1. Sphyr
    Member
    Posted 10 years ago #

    I converted my old Blogger to WordPress this week at http://www.chasingthewind.net . It's working great.
    I have a couple of dozen posts where I first started over at Livejournal. What happens if I convert twice?
    I'm hoping it'll add the old Livejournal posts to my current WordPress. I'm worried that instead it'll munge the entire database, corrupting it so it's completely trashed.

  2. Sphyr
    Member
    Posted 10 years ago #

    I'm trying to read the "import-livejournal.php" file but I don't know php yet. But this part looks like it only inserts posts:

    $wpdb->query("INSERT INTO $tableposts
    (post_author, post_date, post_date_gmt, post_content, post_title,post_status, comment_status, ping_status, post_name)
    VALUES
    ('$post_author', '$post_date', DATE_ADD('$post_date', INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE), '$content', '$title', 'publish', '$comment_status', '$ping_status', '$post_name')");
    $post_id = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_title = '$title' AND post_date = '$post_date'");
    if (!$post_id) die("couldn't get post ID");
    $exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_id AND category_id = 1");
    if (!$exists) $wpdb->query("INSERT INTO $tablepost2cat (post_id, category_id) VALUES ($post_id, 1) ");
    echo 'Done!

  3. ';

    I'd like a pair of eyes that knows php to confirm that first. :/

  • Sphyr
    Member
    Posted 10 years ago #

    Never mind. I got impatient. :P
    Also after reading the php, it was pretty clear this was an importer, meant to be run more than once, so I should be safe.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags

    No tags yet.