1
wishcraft
Migrating from D3Forum or CBB to XForum

Translations are done in the following processes with CBB Translations if you want to import them into XForum 5.80:

* language/english/main.php - Rename _MD_ to _MD_XFORUM_ - Then import the translation at the based of the file from XForum ZIP.
* language/english/admin.php - Rename _AM_NEWBB_ to _AM_XFORUM_ - Then import the translation at the based of the file from XForum ZIP.
* language/english/modinfo.php - Rename _MI_NEWBB_ to _MI_XFORUM_ - Then import the translation at the based of the file from XForum ZIP.
* language/english/blocks.php - Rename _MB_NEWBB_ to _MB_XFORUM_ - Then import the translation at the based of the file from XForum ZIP.

Now to import CBB, I found on large forums you have to rename the tables and add the fields with SQLyog or phpMyAdmin. This is forums where the database is larger than say 500Gb, for some reason importing it will corrupts it cause MySQL can't handle an injection above around 700Gb on the fly.

I will package these scripts in the extra section of XForum 5.80 so look in the extras folder if you need them, but you need to put migratetoxforum.php in your XOOPS ROOT PATH and run it once to migrate the forum. Remember if you have a BIG Forum you have to do it manually and migrate the tables by renaming them and adding any missing fields.


    
//    Code Edited -- 16/11/2011 -- 3:57 AM AEST --
    //    migratetoxforum.php - For Migration between CBB and XForum
    
    
include('mainfile.php');
    
    
$sql = array();
    
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_archive") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_attachments") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_categories") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_digest") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_forums") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_moderates") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_online") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_posts") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_posts_text") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_reads_forum") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_reads_topic") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_report") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_topics") . "`";
    
$sql[] = "TRUNCATE " "`" $GLOBALS['xoopsDB']->prefix("xf_votedata") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_archive") . "` (`topic_id`, `post_id`, `post_text`) SELECT * FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_archive") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_attachments") . "` (`attach_id`, `post_id`, `name_saved`, `name_disp`, `mimetype`, `online`, `attach_time`, `download`) SELECT * FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_attachments") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_categories") . "` (`cat_id`, `cat_image`, `cat_title`, `cat_description`, `cat_order`, `cat_url`, `cat_domain`, `cat_domains`, `cat_languages`) SELECT (`cat_id`, `cat_image`, `cat_title`, `cat_description`, `cat_order`, `cat_url`, '".$_SERVER['HTTP_HOST']."', '".serialize(array($_SERVER['HTTP_HOST']))."', '".serialize(array($GLOBALS['xoopsConfig']['language']))."') FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_attachments") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_digest") . "` (`digest_id`, `digest_time`, `digest_content`) SELECT * FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_digest") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_forums") . "` (`forum_id`, `forum_name`, `forum_desc`, `parent_forum`, `forum_moderator`, `forum_topics`, `forum_posts`, `forum_last_post_id`, `cat_id`, `hot_threshold`, `forum_order`, `attach_maxkb`, `attach_ext`, `allow_polls`, `domain`, `domains`, `languages`) SELECT (`forum_id`, `forum_name`, `forum_desc`, `parent_forum`, `forum_moderator`, `forum_topics`, `forum_posts`, `forum_last_post_id`, `cat_id`, `hot_threshold`, `forum_order`, `attach_maxkb`, `attach_ext`, `allow_polls`, '".$_SERVER['HTTP_HOST']."', '".serialize(array($_SERVER['HTTP_HOST']))."', '".serialize(array($GLOBALS['xoopsConfig']['language']))."') FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_forums") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_moderates") . "` (`mod_id`, `mod_start`, `mod_end`, `mod_desc`, `uid`, `ip`, `forum_id`) SELECT * FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_moderates") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_online") . "` (`online_forum`, `online_topic`, `online_uid`, `online_uname`, `online_ip`, `online_updated`) SELECT * FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_online") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_posts") . "` (`post_id`, `pid`, `topic_id`, `forum_id`, `post_time`, `uid`, `poster_name`, `poster_ip`, `subject`, `icon`, `attachsig`, `approved`, `post_karma`, `attachment`, `require_reply`) SELECT (`post_id`, `pid`, `topic_id`, `forum_id`, `post_time`, `uid`, `poster_name`, `poster_ip`, `subject`, `icon`, `attachsig`, `approved`, `post_karma`, `attachment`, `require_reply`) FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_posts") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_posts_text") . "` (`post_id`, `post_text`, `post_edit`) SELECT (`post_id`, `post_text`, `post_edit`) FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_posts_text") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_reads_forum") . "` (`read_id`, `uid`, `read_time`, `read_item`, `post_id`) SELECT (`read_id`, `uid`, `read_time`, `read_item`, `post_id`) FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_reads_forum") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_reads_topic") . "` (`read_id`, `uid`, `read_time`, `read_item`, `post_id`) SELECT (`read_id`, `uid`, `read_time`, `read_item`, `post_id`) FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_reads_topic") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_report") . "` (`report_id`, `post_id`, `reporter_uid`, `reporter_ip`, `report_text`, `report_result`, `report_memo`) SELECT (`report_id`, `post_id`, `reporter_uid`, `reporter_ip`, `report_text`, `report_result`, `report_memo`) FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_report") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_topics") . "` (`topic_id`, `topic_title`, `topic_poster`, `topic_time`, `topic_views`, `topic_replies`, `topic_last_post_id`, `forum_id`, `topic_status`, `topic_sticky`, `topic_digest`, `digest_time`, `approved`, `poster_name`, `rating`, `votes`, `topic_haspoll`, `poll_id`) SELECT (`topic_id`, `topic_title`, `topic_poster`, `topic_time`, `topic_views`, `topic_replies`, `topic_last_post_id`, `forum_id`, `topic_status`, `topic_sticky`, `topic_digest`, `digest_time`, `approved`, `poster_name`, `rating`, `votes`, `topic_haspoll`, `poll_id`) FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_topics") . "`";
    
$sql[] = "INSERT INTO " "`" $GLOBALS['xoopsDB']->prefix("xf_votedata") . "` (`ratingid`, `topic_id`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`) SELECT (`ratingid`, `topic_id`, `ratinguser`, `rating`, `ratinghostname`, `ratingtimestamp`) FROM " "`" $GLOBALS['xoopsDB']->prefix("bb_votedata") . "`";
    
    include(
'header.php');
    
    foreach(
$sql as $id => $question) {
        if (
$GLOBALS['xoopsDB']->queryF($question)) {
            
xoops_error($question'SQL Executed Successfully');
        }
    }
    
    include(
'footer.php');
    
?>


Use this PHP Script called something like migratetoxforum.php in your XOOPS_ROOT_PATH for migrating from d3Forum over to XForum 5.80

    // RUN ONCE FROM THE XOOPS_ROOT_PATH
    
    // Stable: 20/12/2010 4:06 AM

    
include ('mainfile.php');
    
    
$sql = array();
    
$sql[] = 'TRUNCATE '.$GLOBALS['xoopsDB']->prefix('xf_categories'); 
    
$sql[] = 'INSERT INTO '.$GLOBALS['xoopsDB']->prefix('xf_categories').' (cat_id, cat_title, cat_description, cat_order) SELECT cat_id, cat_title, cat_desc, cat_weight FROM '.$GLOBALS['xoopsDB']->prefix('d3forum_categories'); 
    
$sql[] = 'TRUNCATE '.$GLOBALS['xoopsDB']->prefix('xf_forums'); 
    
$sql[] = 'INSERT INTO '.$GLOBALS['xoopsDB']->prefix('xf_forums').' (forum_id, cat_id, forum_name, forum_desc, forum_last_post_id, forum_topics, forum_posts, forum_order) SELECT forum_id, cat_id, forum_title, forum_desc, forum_last_post_id, forum_topics_count, forum_posts_count, forum_weight FROM '.$GLOBALS['xoopsDB']->prefix('d3forum_forums'); 
    
$sql[] = 'TRUNCATE '.$GLOBALS['xoopsDB']->prefix('xf_posts');
    
$sql[] = 'INSERT INTO '.$GLOBALS['xoopsDB']->prefix('xf_posts').' (post_id, pid, topic_id, post_time, uid, poster_name, `subject`) SELECT post_id, pid, topic_id, post_time, uid, guest_name, `subject` FROM '.$GLOBALS['xoopsDB']->prefix('d3forum_posts'); 
    
$sql[] = 'TRUNCATE '.$GLOBALS['xoopsDB']->prefix('xf_posts_text'); 
    
$sql[] = 'INSERT INTO '.$GLOBALS['xoopsDB']->prefix('xf_posts_text').' (post_id, post_text)  SELECT post_id, post_text FROM '.$GLOBALS['xoopsDB']->prefix('d3forum_posts'); 
    
$sql[] = 'TRUNCATE '.$GLOBALS['xoopsDB']->prefix('xf_topics'); 
    
$sql[] = 'INSERT INTO '.$GLOBALS['xoopsDB']->prefix('xf_topics').' (topic_id, forum_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_last_post_id)  SELECT topic_id, forum_id, topic_title, topic_first_uid, topic_first_post_time, topic_views, topic_posts_count, topic_last_post_id FROM '.$GLOBALS['xoopsDB']->prefix('d3forum_topics');
    
    foreach(
$sql as $id=>$question)
        
$GLOBALS['xoopsDB']->queryF($question);
        
    
$topic_handler =& xoops_getmodulehandler('topic''xforum');
    
$post_handler =& xoops_getmodulehandler('post''xforum');
    
$forum_handler =& xoops_getmodulehandler('forum''xforum');
    
    
$posts $post_handler->getObjects(NULLtrue);
    
$topics $topic_handler->getObjects(NULLtrue);
    
$forums $forum_handler->getObjects(NULLtrue);
        
    foreach(
$posts as $post_id => $post) {
        
$post->setVar('forum_id'$topics[$post->getVar('topic_id')]->getVar('forum_id'));
        
$forums[$topics[$post->getVar('topic_id')]->getVar('forum_id')]->setVar('forum_last_post_id'$post->getVar('post_id'));
        
$forums[$topics[$post->getVar('topic_id')]->getVar('forum_id')]->setVar('forum_posts'$forums[$topics[$post->getVar('topic_id')]->getVar('forum_id')]->getVar('forum_posts')+1); 
        
$post_handler->insert($posttrue);
        
$topics[$post->getVar('topic_id')]->setVar('topic_last_post_id'$post->getVar('post_id'));
        
$topics[$post->getVar('topic_id')]->setVar('topic_time'time());
        
        if (!
in_array($post->getVar('topic_id'), $topicsid)) {
            
$topicsid[$post->getVar('topic_id')] = $post->getVar('topic_id');
            
$forums[$topics[$post->getVar('topic_id')]->getVar('forum_id')]->setVar('forum_topics'$forums[$topics[$post->getVar('topic_id')]->getVar('forum_id')]->getVar('forum_topics')+1);            
        } else {
            
$topics[$post->getVar('topic_id')]->setVar('topic_replies'$topics[$post->getVar('topic_id')]->getVar('topic_replies')+1);
        }
        
$topic_handler->insert($topics[$post->getVar('topic_id')]);
        
$forum_handler->insert($forums[$topics[$post->getVar('topic_id')]->getVar('forum_id')], true);
    }
    
    echo 
'done!'
?>


for large d3forum imports you may have to increase the size of the PHP Memory limit if you get an out of memory message. This can vary with the hosting package you are using but for example the following code allows PHP to use 2GB

// put this before or after the inclusion of the main file
ini_set('memory_limit''2048M');


Download XForum 5.80 - For XOOPS 2.5+
Download Now: xoops2.5_xforum_5.80.zip (6.69 MB)
Sourceforge: xoops2.5_xforum_5.80.zip (6.69 MB)
Demo Now: http://xoops.demo.chronolabs.coop
Resized Image
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

Login

Who's Online

313 user(s) are online (222 user(s) are browsing Support Forums)


Members: 0


Guests: 313


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