Alexandr (xsite) wrote,
Alexandr
xsite

Convert miniBB 1.7 base to phpBB

It's a sql script to move users, topics, posts from miniBB 1.7x forum to phpBB.
May be it will be usefull for you.
Users
======================

INSERT INTO phpbb_users (
	user_id,
	username,
	user_regdate,
	user_password,
	user_email, 
	user_icq, 
	user_website, 
	user_occ, 
	user_from, 
	user_interests,
	user_viewemail, 
	user_lang,
	user_dateformat,
	user_actkey,
	user_style,
	user_attachsig,
	user_allowhtml,
	user_notify,
	user_notify_pm,
        user_popup_pm
) SELECT
	user_id,
	username,
	UNIX_TIMESTAMP(user_regdate),
	user_password,
	user_email, 
	user_icq, 
	user_website, 
	user_occ, 
	user_from, 
	user_interest,
	user_viewemail,
	'russian',
	'D M d, Y g:i a',
	'',
	1,
	1,
	0,
	1,
	1,
	1
FROM vzljotsite.minibb_users


INSERT INTO phpbb_groups (
	group_id,
	group_type,
	group_name,
	group_description,
	group_moderator,
	group_single_user
) SELECT
	user_id,
	1,
	'',
	'Personal User',
	0,
	1
FROM vzljotsite.minibb_users



INSERT INTO phpbb_user_group (
	group_id,
	user_id,
	user_pending
) SELECT
	user_id,
	user_id,
	0
FROM vzljotsite.minibb_users
WHERE user_id>14;



Forums
================

INSERT INTO phpbb_forums (
	forum_id,
	cat_id,
	forum_name,
	forum_desc,
	forum_order,
	auth_edit,
	auth_delete,
	auth_sticky,
	auth_announce,
	auth_vote,
	auth_pollcreate,
	auth_attachments
) SELECT 
	forum_id,
	1,
	forum_name,
	forum_desc,
	forum_order,
	1,
	1,
	3,
	3,
	1,
	1,
	3
FROM vzljotsite.minibb_forums;


Topics
=================


INSERT INTO phpbb_topics (
	topic_id,
	forum_id,
	topic_title,
	topic_poster,
	topic_time,
	topic_views,
	topic_status,
	topic_last_post_id, 
	topic_first_post_id
) SELECT 
	topic_id,
	forum_id,
	topic_title,
	topic_poster,
	UNIX_TIMESTAMP(topic_time),
	topic_views,
	topic_status,
	topic_last_post_id, 
	topic_id
FROM vzljotsite.minibb_topics;

Anonymous user: -1 for phpBB, 0 for miniBB
UPDATE phpbb_topics SET topic_poster = -1 WHERE topic_poster = 0;


Posts
================

INSERT INTO phpbb_posts (
	post_id,
	forum_id, 
	topic_id, 
	poster_id, 
	post_time,
	post_username,
	enable_sig
) SELECT
	post_id,
	forum_id, 
	topic_id, 
	poster_id,
	UNIX_TIMESTAMP(post_time),
	'',
	0
FROM vzljotsite.minibb_posts;

Anonymous user:

UPDATE phpbb_posts SET poster_id = -1 WHERE poster_id = 0;
UPDATE phpbb_posts SET post_username='Anonymous' WHERE poster_id=-1;


INSERT INTO phpbb_posts_text (
	post_id,
	post_subject,
	post_text
) SELECT
	post_id,
	'',	
	post_text
FROM vzljotsite.minibb_posts;


last_post_id:

SELECT 
	CONCAT( 'UPDATE phpbb_forums SET forum_last_post_id=', max( post_id ) , ' WHERE forum_id=', forum_id, ';' )
FROM 
	`phpbb_posts`
GROUP BY 
	forum_id;


Counters
======================
1. for forums topics counters

phpbb_forums.forum_topics

SELECT CONCAT(  "UPDATE phpbb_forums SET forum_topics=", count(  *  ) ,  " WHERE forum_id=", forum_id,';' )  FROM phpbb_topics GROUP  BY forum_id;

returns, for example:
UPDATE phpbb_forums SET forum_topics=2 WHERE forum_id=1;
UPDATE phpbb_forums SET forum_topics=141 WHERE forum_id=3;
...

U should execute this output.

2. for forums posts counters

SELECT CONCAT(  "UPDATE phpbb_forums SET forum_posts=", count(  *  ) ,  " WHERE forum_id=", forum_id,';' )  FROM phpbb_posts GROUP  BY forum_id;

3. for topics posts counters
 topic_replies

SELECT CONCAT(  "UPDATE phpbb_topics SET topic_replies=", count(  *  )-1 ,  " WHERE topic_id=", topic_id,  ";"  )  FROM phpbb_posts GROUP  BY topic_id LIMIT 10000


4. users post counters

SELECT CONCAT(  "UPDATE phpbb_users SET user_posts=", count(  *  ) ,  " WHERE user_id=", poster_id,  ";"  )  FROM phpbb_posts GROUP  BY poster_id

Thats all. Join.
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 0 comments