Firefox PHP

Convert phpBB to phorum

Posted by Jens 
All files from this thread

File Name File Size   Posted by Date  
phpbb_to_phorum5_convert.php 7.3 KB open | download charlie.clark 12/13/2004 Read message
phpbb_in.php 13.7 KB open | download charlie.clark 12/13/2004 Read message
phpbb_in.php 19.3 KB open | download charlie.clark 12/15/2004 Read message
phpbb_to_phorum5_convert.php 7.6 KB open | download charlie.clark 12/15/2004 Read message
phpbb_to_phorum5_convert.php 7.5 KB open | download charlie.clark 12/16/2004 Read message
phpbb_in.php 22.9 KB open | download charlie.clark 12/16/2004 Read message
Convert phpBB to phorum
October 10, 2004 11:42AM
Hello.
I'd need to convert my bloated phpBB forums to phorum.
I haven't found these on the web, so I thought it could be useful. Especially for me :-)
MfG Jens
Re: Convert phpBB to phorum
October 10, 2004 08:11PM
two options. Write it or pay someone to write it.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: Convert phpBB to phorum
December 13, 2004 05:04PM
I've started working on just such a conversion.

There are essentially two steps to this: import the data directly and then update or calculate the remaining values necessary. The import is a lot easier if only a single database is used, ie. make your existing phpbb database the target for a Phorum install.

This is work in progress

SQL
// Import user data
DELETE FROM phorum_users;

INSERT INTO phorum_users
(user_id, username, password, active, email, hide_email, date_added, date_last_active, posts)

SELECT
user_id,
username,
user_password,
user_active,
user_email,
user_viewemail,
user_regdate,
user_lastvisit,
user_posts
FROM phpbb_users
WHERE user_id > 0
ORDER by user_id

//Import forums
DELETE FROM phorum_forums;

INSERT INTO phorum_forums (forum_id, name, description, display_order, active, reg_perms, pub_perms,
list_length_flat, list_length_threaded, read_length)

SELECT
DISTINCT forums.forum_id, forum_name, forum_desc, forum_order, 1, 15, 1, 20, 10, 10)
FROM phpbb_forums AS forums

//Import topics and posts
//In phpbb topics have their own table and need to be imported first
DELETE FROM phorum_messages;

INSERT INTO phorum_messages
(message_id, forum_id, user_id, subject, datestamp, modifystamp)

SELECT
topic_id,
forum_id,
topic_poster,
topic_title,
topic_time,
topic_time as edit_time
FROM phpbb_topics;


INSERT INTO phorum_messages
(forum_id, parent_id, user_id, subject, body, datestamp, modifystamp)

SELECT
posts.forum_id,
posts.topic_id,
poster_id,
topic_title,
post_text,
post_time,
post_edit_time
FROM phpbb_posts AS posts
INNER JOIN phpbb_topics AS topics ON
(topics.topic_id = posts.topic_id)
INNER JOIN phpbb_posts_text AS texts ON
(texts.post_id = posts.post_id)

Now most of the data is in the database but remains invisible as Phorum relies on several attributes such as message_count, thread_count and meta in order to display items and calculate URL's correctly.

It looks as if calling
phorum_db_update_forum_stats($forum_id)
phorum_db_update_message($message_id, $message)
or simply call
phorum_update_thread_info($thread)
but I haven't got these quite working yet - would very much appreciate some pointers and explanations.

Charlie
Re: Convert phpBB to phorum
December 13, 2004 06:29PM
The Phorum 3 to Phorum 5 converter is written in such a way that you should be able to just remove the part that reads in Phorum 3 data and add in a part to read phpBB data instead. As long as its formatted in the same way, the converter will handle the process of putting it all into Phorum 5's database for you.
Re: Convert phpBB to phorum
December 13, 2004 06:31PM
I suggest just doing what Tridus recommended but here are some explanations too:
> phorum_db_update_forum_stats($forum_id)

Updates the data shown on the forum-list.
Should be enough to call it once for every forum with a full refresh

> phorum_update_thread_info($thread)

needs to be run once per thread when all messages of this thread are loaded (I do it more often just for being safe).




Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Convert phpBB to phorum
December 13, 2004 07:00PM
Thanks for the tips. I'm going through it now.
Re: Convert phpBB to phorum
December 13, 2004 08:53PM
I've got some half-working code now. Anybody interested in testing / helping me complete it?

It will currently run and run without generating errors and insert data into the forums and the messages but currently every messages is being given the same folder.

phpbb_to_phorum5_convert.php should be in the Phorum main folder and phpbb_in.php in the /scripts folder



Edited 1 time(s). Last edit at 12/13/2004 08:55PM by charlie.clark.
Attachments:
open | download - phpbb_to_phorum5_convert.php (7.3 KB)
open | download - phpbb_in.php (13.7 KB)
Re: Convert phpBB to phorum
December 13, 2004 08:56PM
I can't test it as I have no running phpbb but I could help you if run into trouble ;).

is that part with "is being given the same folder" a bug or just not yet implemented?


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Convert phpBB to phorum
December 13, 2004 10:09PM
Thanks for the off help.

That is a bug. I've got about 16,500 messages to import and they all get assigned to the same forum. The first forum gets processed very quickly, the second one takes about ten times as long which suggests something recursive.

This is what I have for my incoming forums so far:
Array ( [0] => 4 [forum_id] => 4 [1] => 4 [cat_id] => 4 [2] => Suggestions [forum_name] => Suggestions [3] => Zeta users are smart, share your brilliant ideas with everyone! [forum_desc] => Zeta users are smart, share your brilliant ideas with everyone! [4] => 0 [forum_status] => 0 [5] => 61 [forum_main] => 61 [6] => f [forum_type] => f [7] => 120 [forum_order] => 120 [8] => 3966 [forum_posts] => 3966 [9] => 404 [forum_topics] => 404 [10] => 19122 [forum_last_post_id] => 19122 [11] => [prune_next] => [12] => 0 [prune_enable] => 0 [13] => 0 [auth_view] => 0 [14] => 0 [auth_read] => 0 [15] => 1 [auth_post] => 1 [16] => 1 [auth_reply] => 1 [17] => 1 [auth_edit] => 1 [18] => 1 [auth_delete] => 1 [19] => 3 [auth_sticky] => 3 [20] => 3 [auth_announce] => 3 [21] => 2 [auth_global_announce] => 2 [22] => 1 [auth_vote] => 1 [23] => 1 [auth_pollcreate] => 1 [24] => 0 [auth_attachments] => 0 [25] => Office Suite [forum_last_title] => Office Suite [26] => -1 [forum_last_poster] => -1 [27] => [forum_last_username] => [28] => 1092249905 [forum_last_time] => 1092249905 [29] => [forum_link] => [30] => 0 [forum_link_hit_count] => 0 [31] => 0 [forum_link_hit] => 0 [32] => 0 [forum_link_start] => 0 [33] => 1 [forum_style] => 1 [34] => [forum_nav_icon] => [35] => [forum_icon] => [36] => 0 [forum_topics_ppage] => 0 [37] => [forum_topics_sort] => [38] => [forum_topics_order] => [39] => 0 [forum_index_pack] => 0 [40] => 0 [forum_index_split] => 0 [41] => 0 [forum_board_box] => 0 )
Re: Convert phpBB to phorum
December 13, 2004 10:19PM
If I didn't miss something you select *all* the messages in phorum_convert_selectMessages ... you should only select the ones for this forum.
does phpbb have all the messages in one table too? then you don't need to compute offsets or new message-ids.

also you have lots of phorum3-related code still there ;).


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Sorry, only registered users may post in this forum.

Click here to login