Do you guys have a way to port from phpBB?

or phorum for that matter?

any idea where I might find anyone who had done such a thing?

r.

Comments

rheo’s picture

What might be better is a good way to just integrate phpBB right into drupal..

honestly phpBB is a better BBS but drupal is great in may other ways..

r.

gmalcolm’s picture

I've hit some snags and am working my way through this but would appreciate any tips from others that might be more familiar with the workings of forums and comments in Drupal 4.5.2

I'm migrating from an oldish version of Phorum and migrated a couple of thousand user accounts across without any trouble:

http://drupal.org/node/9806#comment-30028

I've tested migrating several thousand of 25k phorum posts across but I suspect I'm missing something somewhere. Rather than hacking the tables direct, maybe there are some Drupal functions I need to RTFM about that will help me here?

All the nodes and comments are across. Blocks for forum topics and recent comments display fine and I can view the topics and comments just fine (not properly threaded yet, but they're all attached to their parents!)

But MySQL virtually hangs and takes forever to display the forums page (if at all) as an anonymous user and when I visit as uid 1 the forums page comes up quicker but displays a negative number of new nodes???

It's Almost Working For Me (TM)

;-)

// foreach phorum post {
        // check to see if author has a drupal.uid
        $result=db_query("SELECT uid FROM {users} WHERE (mail='%s' OR name='%s')",$ph_email,$ph_author);
        $uid=db_result($result);

        // no uid found, assign anonymous drupal.uid
        if ($uid='') {
                $uid=0;
        }

        // replace newlines in body
        $ph_body=ereg_replace("\n","<br>",$ph_body);

        // rewrite datestamp
        $ph_datestamp=strtotime($ph_datestamp);

        // i think I can assume new topics will precede discussion threads
        // as I've ordered results by phorum post id

        // is this a "new topic"?
        if ($ph_parent==0){
                // yes, we need to make this a node
                //insert new node
                db_query("INSERT INTO {node} (type,title,uid,status,created,changed,comment,moderate,body,format) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')","forum",$ph_subject,$uid,1,$ph_datestamp,$ph_datestamp,2,0,$ph_body,3);

                //grab last insert id
                $nid=mysql_insert_id();

                // record ph_id for this nid so we can retrieve it later
                db_query("INSERT INTO phorum_migrate (phid,nid) VALUES ('%s', '%s')",$ph_id,$nid);

                // insert forum setting tid!!
                db_query("INSERT INTO {forum} (nid,tid) VALUES ('%s','%s')",$nid,$tid);

                //also insert term_node
                db_query("INSERT INTO {term_node} (nid,tid) VALUES ('%s','%s')",$nid,$tid);

                // also set node_access
                db_query("INSERT INTO {node_access} (nid,gid,realm,grant_view,grant_update,grant_delete) VALUES ('%s','%s','%
s','%s','%s','%s')",$nid,0,'og_group',1,0,0);

                // a little feedback
                echo "New topic ".$nid." ".$ph_subject."<br>";

        }else{
                // no, we need to make this a comment
                // find the nid for this ph_id
                // see note above renew topics (nodes/parents) occurring before children (comments)
                $result=db_query("select nid from phorum_migrate where phid='%s'",$ph_thread);
                $nid=db_result($result);

                // if there's a ph_parent find the parent's cid
                if ($ph_parent!=0) {
                        $result=db_query("select cid from phorum_migrate where phid='%s'",$ph_parent);
                        $pid=db_result($result);
                }

                // how do I write the thread string??
                // maybe: http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/tdobes/phpws_to_drupal/phpws08x_to_drupa
l.php?rev=1.1&view=markup
                // leave thread=''

                //insert new comment
                db_query("INSERT INTO {comments} (pid,nid,uid,subject,comment,hostname,timestamp,score,status,format,users,na
me,mail) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",$pid,$nid,$uid,$ph_subject,$ph_body,$ph_h
ost,$ph_datestamp,0,0,3,0,$ph_author,$ph_email);

                //grab last insert id
                $cid=mysql_insert_id();

                // record ph_id for this cid so we can retrieve it later
                db_query("INSERT INTO phorum_migrate (phid,cid) VALUES ('%s', '%s')",$ph_id,$cid);

                // update node_comment_statistics
                $result=db_query("SELECT comment_count FROM {node_comment_statistics} where nid='%s'",$nid);
                $comment_count=db_result($result);
                if ($comment_count>0) {
                        $comment_count++;
                        db_query("UPDATE {node_comment_statistics} SET last_comment_timestamp='%s',last_comment_name='%s',last_comment_uid='%s',comment_count='%s' WHERE nid='%s'",$ph_datestamp,$ph_author,$uid,$comment_count,$nid);
                } else {
                        $comment_count=1;
                        db_query("INSERT INTO {node_comment_statistics} (nid,last_comment_timestamp,last_comment_name,last_co
mment_uid,comment_count) VALUES ('%s','%s','%s','%s','%s')",$nid,$ph_datestamp,$ph_author,$uid,$comment_count);
                }

                // update history
                $result=db_query("SELECT nid FROM {history} where nid='%s'",$nid);
                $ok=db_result($result);
                if ($ok!='') {
                        db_query("UPDATE {history} SET uid='%s',timestamp='%s' WHERE nid='%s'",$uid,$ph_datestamp,$nid);
                } else {
                        db_query("INSERT INTO {history} (nid,uid,timestamp) VALUES ('%s','%s','%s')",$nid,$uid,$ph_datestamp);
                }

                // a little feedback
                echo "Comment ".$cid." ".$ph_subject."<br>";
        }
}

Theatre Australia
http://theatre.asn.au/