PEAK XOOPS - CBB (3.08) --> D3forum .81(current) in englishin japanese

CBB (3.08) --> D3forum .81(current)

List posts in the topic

question CBB (3.08) --> D3forum .81(current)

msg# 1
depth:
0
Previous post - Next post | Parent - Children.1 .2 .3 .4 | Posted on 2008/2/11 7:21
MrTheme  二等兵   Posts: 8
Hello GiJoe

I am trying to nail down the converter for cbb3 to your forum module.

However. I have ran into a few snags and cannot seem to find a solution.

function d3forum_import_from_cbb( $mydirname , $import_mid )
{
	$db =& Database::getInstance() ;
	$from_prefix = 'bb' ;

	// get group_ids
	$group_handler =& xoops_gethandler( 'group' ) ;
	$group_objects =& $group_handler->getObjects() ;
	$group_ids = array() ;
	foreach( $group_objects as $group_object ) {
		$group_ids[] = $group_object->getVar('groupid') ;
	}

	// categories
	$table_name = 'categories' ;
	$to_table = $db->prefix( $mydirname.'_'.$table_name ) ;
	$from_table = $db->prefix( $from_prefix.'_'.$table_name ) ;
	$db->query( "DELETE FROM `$to_table`" ) ;
	$irs = $db->query( "INSERT INTO `$to_table` (cat_id,cat_title,cat_weight) SELECT cat_id,cat_title,cat_order FROM `$from_table`" ) ;
	if( ! $irs ) d3forum_import_errordie() ;

	// forums
	$table_name = 'forums' ;
	$to_table = $db->prefix( $mydirname.'_'.$table_name ) ;
	$from_table = $db->prefix( $from_prefix.'_'.$table_name ) ;
	$db->query( "DELETE FROM `$to_table`" ) ;
	$irs = $db->query( "INSERT INTO `$to_table` (forum_id,forum_title,forum_desc,forum_weight,cat_id) SELECT forum_id,forum_name,forum_desc,forum_order,cat_id FROM `$from_table`" ) ;
	if( ! $irs ) d3forum_import_errordie() ;

	// topics
	$table_name = 'topics' ;
	$to_table = $db->prefix( $mydirname.'_'.$table_name ) ;
	$from_table = $db->prefix( $from_prefix.'_'.$table_name ) ;
	$db->query( "DELETE FROM `$to_table`" ) ;
	$irs = $db->query( "INSERT INTO `$to_table` (topic_id,topic_title,topic_views,forum_id,topic_locked,topic_sticky,topic_solved,topic_invisible) SELECT topic_id,topic_title,topic_views,forum_id,topic_status,topic_sticky,1,approved FROM `$from_table`" ) ;
	if( ! $irs ) d3forum_import_errordie() ;

	// posts
	$table_name = 'posts' ;
	$to_table = $db->prefix( $mydirname.'_'.$table_name ) ;
	$from_table = $db->prefix( $from_prefix.'_'.$table_name ) ;
	$from_text_table = $db->prefix( $from_prefix.'_'.'posts_text') ;
	$db->query( "DELETE FROM `$to_table`" ) ;
	$irs = $db->query( "INSERT INTO `$to_table` (post_id,pid,topic_id,post_time,modified_time,uid,poster_ip,modifier_ip,subject,html,smiley,xcode,br,number_entity,special_entity,icon,attachsig,invisible,approval,post_text) SELECT p.post_id,pid,topic_id,post_time,post_time,uid,poster_ip,poster_ip,subject,!nohtml,!nosmiley,1,1,1,1,IF(SUBSTRING(icon,5,1),SUBSTRING(icon,5,1),1),attachsig,0,1,pt.post_text FROM `$from_table` p LEFT JOIN `$from_text_table` pt ON p.post_id=pt.post_id" ) ;
	if( ! $irs ) d3forum_import_errordie() ;
}

Works sometimes, not all the time. This will import (only when it feels like it):

Categories
Forums
Topics
Posts

But never posts_text. I took out all of the permission based queries, because the tables don't exist in cbb. So users would need to reset their permissions after import, but the import thing is that we are able to move away from cbb.

I have made the modifications to admin_advanced.php as well so that it knows to execute the d3forum_import_from_cbb.

I am not sure if you have given any more thought to creating a conversion from cbb. If so, that would be fantastic! Many people would highly enjoy moving to d3. If not, is there anything that you can notice from above that may be causing my problem?

Also, why does it only sporadically work?

Thanks for any light you can shed.
Votes:5 Average:8.00

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!