1
S25ofa0tu
Convert PHPBB to NewB B
  • 2005/4/16 22:52

  • S25ofa0tu

  • Just popping in

  • Posts: 4

  • Since: 2005/4/16


Hi i was wondering is there a conversion program for this?Also if there is does anyone know of one for IPB 2.0 as i have a friend who may convert

2
S25ofa0tu
Re: Convert PHPBB to NewB B
  • 2005/4/17 15:56

  • S25ofa0tu

  • Just popping in

  • Posts: 4

  • Since: 2005/4/16


This WILL do it

# phpBB 2.0 to XoopsBB 1.0 Converter
# Copyright (C) 2002 Randall Emery
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# Purpose:
#
# The script was designed to transfer categories, forums, users, and posts
# from phpBB 2.0 to XoopsBB 1.0.
#
# Assumptions:
#
# - phpBB 2.0 and XoopsBB 1.0 are installed on the same database
# - if user is in both phpBB an XoopsBB, they have the same user name in
# - XoopsBB 1.0 is currently empty and phpBB 2.0 has contents to transfer
# - phpBB 2.0 tables are prefixed with "phpbb_"
# - XoopsBB 1.0 tables are prefixed with "xoops_bb_"
#
# If the phpBB 2.0 and XoopsBB 1.0 tables are on different databases, please
# do a dump of the phpBB 2.0 tables and add then do a restore to the
# database that contains your XOOPS installation.
#
# If you have users on both systems, make sure that they have the same user
# name in each system before running this script.
#
# If your table prefixes differ, please do a global search on these prefixes,
# replacing them with the correct prefixes for your installation.
#
# Directions:
#
# This script can be executed using phpMyAdmin or from the command line.
# Using phpMyAdmin, you can first click on the name of your database, then
# scroll down until you see "Run SQL query/queries on database". You can either
# cut and paste this script into this area, or locate this script from your
# home machine by pressing the "Browse:" button and then clicking on "Go."
# To run this script from the command line, use the following format:
# MySQL -u -p -h database < phpBB2_XoopsBB_Converter.sql
#
# Notes:
#
# Due to differences in supported functionality between phpBB 2.0 and XoopsBB 1.0,
# some items cannot be converted:
#
# - Polls that accompany topics
# - Topics watch (e-mail alerts when responses are posted)
# - Security by group (groups are copied, but security is translated to indidual users)
#
# Known issues:
#
# - Number of posts is not converted for users that already exist in Xoops
# - If your users have avatars, they will have to reload them

# Preliminary step - clear out Xoops_BB tables
# This is here primarily in case there is an error in the script and you need to execute again.

DELETE FROM xoops_bb_posts_text;
DELETE FROM xoops_bb_posts;
DELETE FROM xoops_bb_topics;
DELETE FROM xoops_bb_forum_access;
DELETE FROM xoops_bb_forums;
DELETE FROM xoops_bb_categories;

# First, copy over categories.

INSERT INTO xoops_bb_categories (cat_id, cat_title, cat_order)
SELECT cat_id, cat_title, format(cat_order, 0)
FROM phpbb_categories ;

# Second, copy forums.
#
# The security set ups are not identical in each system. The following translation rules are used:
# If phpBB forum read access = ALL, set XoopsBB forum type to Public, else set forum type to Private.
# If phpBB forum post access = ALL, set XoopsBB forum access to Anonymous,
# else if forum post access = REG or PRIVATE, set forum access to Registered Users Only,
# else set forum access to Moderators Only.

INSERT INTO xoops_bb_forums (forum_id, forum_name, forum_desc, forum_topics, forum_last_post_id, cat_id,
forum_type, forum_access, forum_posts)
SELECT forum_id, forum_name, forum_desc, forum_topics, forum_last_post_id, cat_id,
IF(auth_read=0,0,1), IF(auth_post=0,2,IF(auth_post<3,1,3)), forum_posts
FROM phpbb_forums ;

# Third, copy users. This is a complex step because some users may exist in both systems
# and some may only exist in one system.

CREATE TABLE temp_uid_map (phpbb_uid mediumint(8), xoops_bb_uid int(5) NULL, link int(1) default 1) ;

# New users from phpBB

# Note: following table is only required because MySQL does not support
# nested select functionality in UPDATE command (planned for MySQL 4)

CREATE TABLE temp_max_xoops_uid (max_uid int(5) NULL, link int(1) default 1);

INSERT INTO temp_max_xoops_uid (max_uid)
SELECT uid
FROM xoops_users
ORDER BY uid DESC
LIMIT 1;

INSERT INTO temp_uid_map (phpbb_uid, xoops_bb_uid)
SELECT p.user_id, m.max_uid+p.user_id
FROM phpbb_users p
LEFT JOIN xoops_users x ON p.username = x.uname
LEFT JOIN temp_max_xoops_uid m ON m.link = 1
WHERE x.uname IS NULL
AND p.user_id > 0;

DROP TABLE temp_max_xoops_uid;

INSERT INTO xoops_users (uid, name, uname, email, url,
user_regdate, user_from, user_sig, user_viewemail,
user_aim, user_yim, user_msnm, user_icq,
pass, posts, attachsig,
theme, umode, bio, user_avatar)
SELECT t.xoops_bb_uid, ' ', p.username, left(p.user_email,60), p.user_website,
p.user_regdate, p.user_from, p.user_sig, IF(p.user_viewemail is null, 0, p.user_viewemail),
p.user_aim, p.user_yim, p.user_msnm, p.user_icq,
p.user_password, p.user_posts, p.user_attachsig,
' ', 'flat', ' ', 'blank.gif'
FROM phpbb_users p, temp_uid_map t
WHERE p.user_id = t.phpbb_uid ;

# Matching user IDs - don't copy over any user information

INSERT INTO temp_uid_map (phpbb_uid, xoops_bb_uid)
SELECT p.user_id, x.uid
FROM phpbb_users p, xoops_users x
WHERE p.username = x.uname ;

# Anonymous user IDs

INSERT INTO temp_uid_map (phpbb_uid, xoops_bb_uid) values (-1,0) ;

# Fourth, copy security access to forums.

INSERT INTO xoops_bb_forum_access (forum_id, user_id, can_post)
SELECT a.forum_id, t.xoops_bb_uid, a.auth_post
FROM phpbb_auth_access a, phpbb_user_group u,
phpbb_forums f, temp_uid_map t
WHERE a.group_id = u.group_id
AND a.forum_id = f.forum_id
AND u.user_id = t.phpbb_uid
AND a.auth_read = 1
AND f.auth_read > 0
AND u.user_id > 0;

# Fifth, copy topics.

INSERT INTO xoops_bb_topics (topic_id, topic_title, topic_poster,
topic_time, topic_views, topic_replies, topic_last_post_id, forum_id)
SELECT p.topic_id, p.topic_title, t.xoops_bb_uid,
p.topic_time, p.topic_views, p.topic_replies, p.topic_last_post_id, p.forum_id
FROM phpbb_topics p, temp_uid_map t
WHERE p.topic_poster = t.phpbb_uid;

# Sixth, copy individual posts.

INSERT INTO xoops_bb_posts (post_id, topic_id, forum_id, post_time, uid,
poster_ip, subject, nohtml, nosmiley, attachsig)
SELECT p.post_id, p.topic_id, p.forum_id, p.post_time, t.xoops_bb_uid,
p.poster_ip, x.post_subject, NOT p.enable_html, NOT p.enable_smilies, p.enable_sig
FROM phpbb_posts p, phpbb_posts_text x, temp_uid_map t
WHERE p.poster_id = t.phpbb_uid
AND p.post_id = x.post_id;

# Seventh, copy post text.

INSERT INTO xoops_bb_posts_text (post_id, post_text)
SELECT post_id, replace(post_text, concat(':',bbcode_uid), '') FROM phpbb_posts_text;

# Clean up.

DROP TABLE temp_uid_map;

3
S25ofa0tu
Re: Convert PHPBB to NewB B
  • 2005/4/17 19:44

  • S25ofa0tu

  • Just popping in

  • Posts: 4

  • Since: 2005/4/16


Im sorry for triple posting but i have a question on a different subject after i did the the conversion allot of my members had problems logging into the forums it keeps saying they dont have permission to access it?How do i either change the permissions of the forum or users but i do not realy think that will solve it as i made an account and that would not log in so maybe its only previos members with this problem.Anyone else experience this problem?Or have an idea on how to fix it
Thanks in advance
James

4
jefmwols
Re: Convert PHPBB to NewB B
  • 2005/4/23 20:34

  • jefmwols

  • Just popping in

  • Posts: 4

  • Since: 2005/4/23


I have searched this and the development site but have not found a way to convert phpbb to newbb2. I tried to modify the above script but was not very successful.

Is there a way to convert phpbb to newbb 2.0.2?

5
mohrt
Re: Convert PHPBB to NewB B
  • 2005/4/27 19:53

  • mohrt

  • Just popping in

  • Posts: 2

  • Since: 2005/4/27


I took the above code and made a few changes to get it to work for me. Basically I added DISTINCT to avoid duplicate key errors, and used TRUNCATE TABLE instead of DELETE FROM. I also pulled phpbb info from a separate PHPBB database in my example instead of tables from within the same db. Then I run this against the XOOPS db like so:

mysql XOOPSDB importphpbb.sql


If you re-run the script, you'll have to clear out the xoops_users table before you do so (except leave the XOOPS admin accounts, etc.)

Here it is:

# phpBB 2.0 to XoopsBB 1.0 Converter
# Copyright (C) 2002 Randall Emery
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# Purpose:
#
# The script was designed to transfer categories, forums, users, and posts
# from phpBB 2.0 to XoopsBB 1.0.
#
# Assumptions:
#
# - phpBB 2.0 and XoopsBB 1.0 are installed on the same database
# - if user is in both phpBB an XoopsBB, they have the same user name in
# - XoopsBB 1.0 is currently empty and phpBB 2.0 has contents to transfer
# - phpBB 2.0 tables are prefixed with "phpbb_"
# - XoopsBB 1.0 tables are prefixed with "xoops_bb_"
#
# If the phpBB 2.0 and XoopsBB 1.0 tables are on different databases, please
# do a dump of the phpBB 2.0 tables and add then do a restore to the
# database that contains your XOOPS installation.
#
# If you have users on both systems, make sure that they have the same user
# name in each system before running this script.
#
# If your table prefixes differ, please do a global search on these prefixes,
# replacing them with the correct prefixes for your installation.
#
# Directions:
#
# This script can be executed using phpMyAdmin or from the command line.
# Using phpMyAdmin, you can first click on the name of your database, then
# scroll down until you see "Run SQL query/queries on database". You can either
# cut and paste this script into this area, or locate this script from your
# home machine by pressing the "Browse:" button and then clicking on "Go."
# To run this script from the command line, use the following format:
# MySQL -u -p -h database < phpBB2_XoopsBB_Converter.sql
#
# Notes:
#
# Due to differences in supported functionality between phpBB 2.0 and XoopsBB 1.0,
# some items cannot be converted:
#
# - Polls that accompany topics
# - Topics watch (e-mail alerts when responses are posted)
# - Security by group (groups are copied, but security is translated to indidual users)
#
# Known issues:
#
# - Number of posts is not converted for users that already exist in Xoops
# - If your users have avatars, they will have to reload them
# Preliminary step - clear out Xoops_BB tables
# This is here primarily in case there is an error in the script and you need to execute again.

TRUNCATE TABLE xoops_bb_posts_text;
TRUNCATE TABLE xoops_bb_posts;
TRUNCATE TABLE xoops_bb_topics;
TRUNCATE TABLE xoops_bb_forum_access;
TRUNCATE TABLE xoops_bb_forums;
TRUNCATE TABLE xoops_bb_categories;

# First, copy over categories.

INSERT INTO xoops_bb_categories (cat_idcat_titlecat_order)
SELECT cat_idcat_titleformat(cat_order0)
FROM PHPBB.categories ;

# Second, copy forums.
#
# The security set ups are not identical in each system. The following translation rules are used:
# If phpBB forum read access = ALL, set XoopsBB forum type to Public, else set forum type to Private.
# If phpBB forum post access = ALL, set XoopsBB forum access to Anonymous,
# else if forum post access = REG or PRIVATE, set forum access to Registered Users Only,
# else set forum access to Moderators Only.

INSERT INTO xoops_bb_forums (forum_idforum_nameforum_descforum_topicsforum_last_post_idcat_id,
forum_typeforum_accessforum_posts)
SELECT forum_idforum_nameforum_descforum_topicsforum_last_post_idcat_id,
IF(
auth_read=0,0,1), IF(auth_post=0,2,IF(auth_post<3,1,3)), forum_posts
FROM PHPBB
.forums ;

# Third, copy users. This is a complex step because some users may exist in both systems
# and some may only exist in one system.

CREATE TABLE IF NOT EXISTS temp_uid_map (phpbb_uid mediumint(8), xoops_bb_uid int(5NULLlink int(1) default 1) ;
TRUNCATE TABLE temp_uid_map;

# New users from phpBB

# Note: following table is only required because MySQL does not support
# nested select functionality in UPDATE command (planned for MySQL 4)

CREATE TABLE temp_max_xoops_uid (max_uid int(5NULLlink int(1) default 1);

INSERT INTO temp_max_xoops_uid (max_uid)
SELECT uid
FROM xoops_users
ORDER BY uid DESC
LIMIT 1
;

INSERT INTO temp_uid_map (phpbb_uidxoops_bb_uid)
SELECT p.user_idm.max_uid+p.user_id
FROM PHPBB
.users p
LEFT JOIN xoops_users x ON p
.username x.uname
LEFT JOIN temp_max_xoops_uid m ON m
.link 1
WHERE x
.uname IS NULL
AND p.user_id 0;

DROP TABLE temp_max_xoops_uid;

INSERT INTO xoops_users (uidnameunameemailurl,
user_regdateuser_fromuser_siguser_viewemail,
user_aimuser_yimuser_msnmuser_icq,
passpostsattachsig,
themeumodebiouser_avatar)
SELECT t.xoops_bb_uid' 'p.usernameleft(p.user_email,60), p.user_website,
p.user_regdatep.user_fromp.user_sig, IF(p.user_viewemail is null0p.user_viewemail),
p.user_aimp.user_yimp.user_msnmp.user_icq,
p.user_passwordp.user_postsp.user_attachsig,
' ''flat'' ''blank.gif'
FROM PHPBB.users ptemp_uid_map t
WHERE p
.user_id t.phpbb_uid ;

# Matching user IDs - don't copy over any user information

INSERT INTO temp_uid_map (phpbb_uidxoops_bb_uid)
SELECT p.user_idx.uid
FROM PHPBB
.users pxoops_users x
WHERE p
.username x.uname ;

# Anonymous user IDs

INSERT INTO temp_uid_map (phpbb_uidxoops_bb_uidvalues (-1,0) ;

# Fourth, copy security access to forums.

INSERT INTO xoops_bb_forum_access (forum_iduser_idcan_post)
SELECT a.forum_idt.xoops_bb_uida.auth_post
FROM PHPBB
.auth_access aPHPBB.user_group u,
PHPBB.forums ftemp_uid_map t
WHERE a
.group_id u.group_id
AND a.forum_id f.forum_id
AND u.user_id t.phpbb_uid
AND a.auth_read 1
AND f.auth_read 0
AND u.user_id 0;

# Fifth, copy topics.

INSERT INTO xoops_bb_topics (topic_idtopic_titletopic_poster,
topic_timetopic_viewstopic_repliestopic_last_post_idforum_id)
SELECT DISTINCT p.topic_idp.topic_titlet.xoops_bb_uid,
p.topic_timep.topic_viewsp.topic_repliesp.topic_last_post_idp.forum_id
FROM PHPBB
.topics ptemp_uid_map t
WHERE p
.topic_poster t.phpbb_uid;

# Sixth, copy individual posts.

INSERT INTO xoops_bb_posts (post_idtopic_idforum_idpost_timeuid,
poster_ipsubjectnohtmlnosmileyattachsig)
SELECT DISTINCT p.post_idp.topic_idp.forum_idp.post_timet.xoops_bb_uid,
p.poster_ipx.post_subjectNOT p.enable_htmlNOT p.enable_smiliesp.enable_sig
FROM PHPBB
.posts pPHPBB.posts_text xtemp_uid_map t
WHERE p
.poster_id t.phpbb_uid
AND p.post_id x.post_id;

# Seventh, copy post text.

INSERT INTO xoops_bb_posts_text (post_idpost_text)
SELECT post_idreplace(post_textconcat(':',bbcode_uid), ''FROM PHPBB.posts_text;

# Clean up.

DROP TABLE temp_uid_map;

6
mohrt
Re: Convert PHPBB to NewB B
  • 2005/4/27 20:04

  • mohrt

  • Just popping in

  • Posts: 2

  • Since: 2005/4/27


I just realized, to log into the forum, each user must have a "registered user" group access.

insert into xoops_groups_users_link select 0,2,uid from xoops_users;


That will give everyone "registered user" group access, but may create duplicates for users already in the system before importing.

7
davidl2
Re: Convert PHPBB to NewB B
  • 2005/5/11 1:43

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


Is it possible change this script so it can be run on a seperate phpbb database - which can then be imported into XOOPS with a newbb install?

Login

Who's Online

179 user(s) are online (122 user(s) are browsing Support Forums)


Members: 0


Guests: 179


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits