Topic: phpBB 3 to punbb convertor ?

Hello,

i'm searching a convertor for phpBB3, i found phpBB2 to punbb only smile

its doesn't exit ? or it's in project ?
(google don't want to help me tongue )

Re: phpBB 3 to punbb convertor ?

Try using the converter for phpBB2, post here if something doesn't work.

3 (edited by lo(ea)l 2007-11-18 22:28)

Re: phpBB 3 to punbb convertor ?

i have tried it ^^ its doesnt work tongue

i have that : Table 'xxx.phpbb3_categories' doesn't exist (Errno: 1146)

for phpbb3 the more similar table is phpbb3_forum, if a rename this table the program cant correctly extract allinformations of this table, the next probleme is with phpbb3_post ; same problem smile

in finish when iam trying to see the forum, i can see the title of recents topic, but i cant see any categorie, forum, message tongue

Re: phpBB 3 to punbb convertor ?

OK, then my best suggestion would be to convert to another forum system that the converter supports and then convert to PunBB.

Re: phpBB 3 to punbb convertor ?

you have a suggestion ? smile

because of the number of message (something like 5000) its no easy to change all table tongue

6

Re: phpBB 3 to punbb convertor ?

convert to phpbb2 then convert your phpbb2 to punbb

Re: phpBB 3 to punbb convertor ?

sure ^^ its the best way, but i dont find a program who can do that smile ( only phpbb2.x to phpbb3.x tongue )
have you a link for that ? tongue

Re: phpBB 3 to punbb convertor ?

I doubt you'll find one. I meant to convert from phpBB 3 to, say, SMF, which PunBB can convert from.

9 (edited by lo(ea)l 2007-11-18 23:09)

Re: phpBB 3 to punbb convertor ?

fiu ^^ ok i look that tongue thank you ^^

edit:
okay ... only convertor from phpBB2 sad humhum ^^
( this site is nice, http://www.simplemachines.org/download/?converters all converters for smf 1.1 tongue )

Re: phpBB 3 to punbb convertor ?

OK, well lets see if I can fix the PunBB converter problems for you one at a time wink
In the phpBB folder, for categories.php
FIND

    // Fetch forum info
    $result = $fdb->query('SELECT * FROM '.$_SESSION['php'].$_SESSION['phpnuke'].'categories') or myerror('Unable to fetch categories', __FILE__, __LINE__, $fdb->error());
    while($ob = $fdb->fetch_assoc($result))
    {
        echo $ob['cat_title'].' ('.$ob['cat_id'].")<br>\n"; flush();

        // Dataarray
        $todb = array(
            'id'                    =>        $ob['cat_id'],
            'cat_name'            =>        $ob['cat_title'],    
            'disp_position'    =>     $ob['cat_order'],
        );

        // Save data
        insertdata('categories', $todb, __FILE__, __LINE__);
    }

REPLACE WITH

    // Fetch forum info
    $result = $fdb->query('SELECT * FROM '.$_SESSION['php'].$_SESSION['phpnuke'].'forums where forum_type=0') or myerror('Unable to fetch categories', __FILE__, __LINE__, $fdb->error());
    while($ob = $fdb->fetch_assoc($result))
    {
        echo $ob['forum_name'].' ('.$ob['forum_id'].")<br>\n"; flush();

        // Dataarray
        $todb = array(
            'id'                    =>        $ob['forum_id'],
            'cat_name'            =>        $ob['forum_name'],    
            'disp_position'    =>     $ob['left_id'],
        );

        // Save data
        insertdata('categories', $todb, __FILE__, __LINE__);
    }

11 (edited by lo(ea)l 2007-11-18 23:42)

Re: phpBB 3 to punbb convertor ?

woah ^^ ok i try it ... smile
the next problem is :
Table 'xxx.phpbb3_posts_text' doesn't exist (Errno: 1146)
( file: /converters/PhpBB/posts.php )

( i'am checking in the table if all categories havent been correctly created smile )

Wow amazing it's working, i can see all categories :pn only post are missing ^^)

Re: phpBB 3 to punbb convertor ?

OK!

phpBB folder, posts.php

FIND

    $result = $fdb->query('SELECT post.post_id, post.post_time, post.poster_id, post.poster_ip, post.topic_id, text.post_subject, text.post_text, users.username FROM '.$_SESSION['php'].$_SESSION['phpnuke'].'posts AS post, '.$_SESSION['php'].$_SESSION['phpnuke'].'posts_text AS text, '.$_SESSION['php'].'users AS users WHERE post.post_id>'.$start.' AND post.post_id=text.post_id AND users.user_id=post.poster_id ORDER BY post.post_id LIMIT '.$_SESSION['limit']) or myerror("Unable to get posts", __FILE__, __LINE__, $fdb->error());

REPLACE WITH

    $result = $fdb->query('SELECT post.post_id, post.post_time, post.poster_id, post.poster_ip, post.topic_id, post.post_subject, post.post_text, users.username FROM '.$_SESSION['php'].$_SESSION['phpnuke'].'posts AS post, '.$_SESSION['php'].'users AS users WHERE post.post_id>'.$start.' AND users.user_id=post.poster_id ORDER BY post.post_id LIMIT '.$_SESSION['limit']) or myerror("Unable to get posts", __FILE__, __LINE__, $fdb->error());

13 (edited by lo(ea)l 2007-11-19 00:06)

Re: phpBB 3 to punbb convertor ?

wow you are amazing ^^

ok i have tried it, all is working, all table are created, but no message connected to categorie smile (all information on punbb_post seems to be good )

( i'm trying 2, 3 thing on the forum ^^ )

ok its strange tongue
i can see all message, if i click the link to see the categorie i see all message of this categorie, but the overview of all forum ... i cant see anyting ^^

interesting, on tables, when i looking punbb_forums, i can see, for all, 0 for cat_id smile

Re: phpBB 3 to punbb convertor ?

ok i found the problem, its something with phpbb3_forums smile
when a forum is transfered, the categories id is alway 0, smile (cat_id for punbb)

Re: phpBB 3 to punbb convertor ?

Oh
phpBB folder, forums.php
This is the new code:

<?php

    // Fetch forum info
    $result = $fdb->query('SELECT * FROM '.$_SESSION['php'].$_SESSION['phpnuke'].'forums WHERE forum_id>'.$start.' AND forum_type != 0 ORDER BY forum_id LIMIT '.$_SESSION['limit']) or myerror('phpBB: Unable to get table: forums', __FILE__, __LINE__, $fdb->error());
    $last_id = -1;
    while($ob = $fdb->fetch_assoc($result))
    {
        $last_id = $ob['forum_id'];
        echo $ob['forum_name'].' ('.$ob['forum_id'].")<br>\n"; flush();

        // Check for anonymous poster id problem
        $ob['forum_last_post_id'] == -1 ? $ob['forum_last_post_id'] = 1 : null;

        // Fetch user info
        $userres = $fdb->query('SELECT users.username, posts.post_time FROM '.$_SESSION['php'].'users AS users, '.$_SESSION['php'].$_SESSION['phpnuke'].'posts AS posts WHERE users.user_id=posts.poster_id AND posts.post_id='.$ob['forum_last_post_id']) or myerror("Unable to fetch user info for forum conversion.", __FILE__, __LINE__, $fdb->error());
        $userinfo = $fdb->fetch_assoc($userres);

        // Change last_post = 0 to null to prevent the time-bug.
        $userinfo['post_time'] == 0 ? $userinfo['post_time'] = 'null' : null;
        $ob['forum_last_post_id'] == 0 ? $ob['forum_last_post_id'] = 'null' : null;

        // Unset variables
        if(!isset($userinfo['username']))
            $userinfo['username'] = 'null';

        // Dataarray
        $todb = array(
            'id'                =>        $ob['forum_id'],
            'forum_name'    =>        $ob['forum_name'],
            'forum_desc'    =>        $ob['forum_desc'],
            'num_topics'    =>        $ob['forum_topics'],
            'num_posts'        =>        $ob['forum_posts'],
            'disp_position'=>        $ob['forum_order'],
            'last_poster'    =>        $userinfo['username'],
            'last_post_id'    =>        $ob['forum_last_post_id'],
            'last_post'        =>        $userinfo['post_time'],
            'cat_id'            =>        $ob['parent_id'],
        );

        // Save data
        insertdata('forums', $todb, __FILE__, __LINE__);
    }

    convredirect('forum_id', $_SESSION['phpnuke'].'forums', $last_id);

?>

16 (edited by lo(ea)l 2007-11-19 00:29)

Re: phpBB 3 to punbb convertor ?

lol you are fast tongue
ok i tested ^^ all working, only one think, all subforum, are not present smile

maybe create a new categorie will be nice ? ^^

i see that for all forum of a "subforum" they have the same "cat_id" for punbb smile

Re: phpBB 3 to punbb convertor ?

Yeah, I was thinking about that: let me see what I can do

Re: phpBB 3 to punbb convertor ?

OK, new code for forums.php, this should put all subforums in their own category.

<?php

    // Fetch forum info
    $result = $fdb->query('SELECT * FROM '.$_SESSION['php'].$_SESSION['phpnuke'].'forums WHERE forum_id>'.$start.' AND forum_type != 0 ORDER BY forum_id LIMIT '.$_SESSION['limit']) or myerror('phpBB: Unable to get table: forums', __FILE__, __LINE__, $fdb->error());
    $last_id = -1;
    while($ob = $fdb->fetch_assoc($result))
    {
        $last_id = $ob['forum_id'];
        echo $ob['forum_name'].' ('.$ob['forum_id'].")<br>\n"; flush();

        // Check for anonymous poster id problem
        $ob['forum_last_post_id'] == -1 ? $ob['forum_last_post_id'] = 1 : null;

        // Fetch user info
        $userres = $fdb->query('SELECT users.username, posts.post_time FROM '.$_SESSION['php'].'users AS users, '.$_SESSION['php'].$_SESSION['phpnuke'].'posts AS posts WHERE users.user_id=posts.poster_id AND posts.post_id='.$ob['forum_last_post_id']) or myerror("Unable to fetch user info for forum conversion.", __FILE__, __LINE__, $fdb->error());
        $userinfo = $fdb->fetch_assoc($userres);

        // Change last_post = 0 to null to prevent the time-bug.
        $userinfo['post_time'] == 0 ? $userinfo['post_time'] = 'null' : null;
        $ob['forum_last_post_id'] == 0 ? $ob['forum_last_post_id'] = 'null' : null;

        // Unset variables
        if(!isset($userinfo['username']))
            $userinfo['username'] = 'null';

        // Dataarray
        $todb = array(
            'id'                =>        $ob['forum_id'],
            'forum_name'    =>        $ob['forum_name'],
            'forum_desc'    =>        $ob['forum_desc'],
            'num_topics'    =>        $ob['forum_topics'],
            'num_posts'        =>        $ob['forum_posts'],
            'disp_position'=>        $ob['forum_order'],
            'last_poster'    =>        $userinfo['username'],
            'last_post_id'    =>        $ob['forum_last_post_id'],
            'last_post'        =>        $userinfo['post_time'],
            'cat_id'            =>        $ob['parent_id'],
        );

        // Save data
        insertdata('forums', $todb, __FILE__, __LINE__);
    }

    // We move all subforums into a new category: they'll have to be properly organized by hand
    $db->query('INSERT INTO '.$_SESSION['pun'].'categories (cat_name, disp_position) VALUES ("Subforums", 100)') or myerror('PunBB: Unable to create subforum category', __FILE__, __LINE__, $fdb->error());
    $db->query('UPDATE '.$_SESSION['pun'].'forums AS f LEFT JOIN '.$_SESSION['pun'].'categories AS c ON (f.cat_id = c.id) SET f.cat_id = '.$db->insert_id().' WHERE c.id IS NULL') or myerror('PunBB: Unable to move subforums to new category', __FILE__, __LINE__, $fdb->error());

    convredirect('forum_id', $_SESSION['phpnuke'].'forums', $last_id);

?>

Re: phpBB 3 to punbb convertor ?

ok i have tried, the missing forum are here, but now all forums are grouped in one categorie "subforum" ^^

Re: phpBB 3 to punbb convertor ?

I updated my code above, try now, see if it changed anything

Re: phpBB 3 to punbb convertor ?

hello, smile

i have tried your code, but the result is the same ^^ (on categorie "subforum" with all forums in smile )

Re: phpBB 3 to punbb convertor ?

Well, can you send me a dump of the phpBB forums table then? Obviously I'm not understanding how phpBB relates forums to categories.

Re: phpBB 3 to punbb convertor ?

ok i put on this forum later, iam very busy for moment smile i dont forget you tongue

24

Re: phpBB 3 to punbb convertor ?

I get this error:

File: /homepages/36/d175509457/htdocs/shadow/punbb/converter/PhpBB/forums.php
Line: 41

Converter reported: Unable to save to database.

Query: INSERT INTO `xxxxxxxxxx`.PUNBB_forums (id,forum_name,forum_desc,num_topics,num_posts,last_poster,last_post_id,last_post,cat_id) VALUES('1','xxxxxxx','xxxxxxxxxxx','16','20','drndadoo','141','1187343698','17')

Database reported: Duplicate entry '1' for key 1 (Errno: 1062)

Re: phpBB 3 to punbb convertor ?

I'm not exactly sure how that's possible, since forum_id is a primary key for phpBB. Unless the converter isn't deleting the old PunBB data, which I've always seen it do, I don't know how that could happen.