drupal

Crepes and cars

Blog entry

Drove up to the City for dinner tonight. I was meeting up with Roland from Bryght, who was down from Vancouver for a conference.

Every time I drive up to the City, I feel guilty. Guilty that I'm not using the mass transportation system that (nominally) works. Guilty that I'm spending over $5 in gas to get there, only to spend another $3 driving around looking for a parking space, and another $5 to drive back.

And yet...

I met Will Pate of Flock, Sarah, Steve, Paul, Roland, Ivan, and Dimitri at the dinner. Tantek, Messina and Tara were all there, too (YAY!). Tara's leaving Riya this Friday, nominally because the new Marketing VP is going to be a suit guy, and because the engineers developing the social software don't actually use the social aspects of the software, and hence have no clue how to build it. Neil showed up later, as did James Walker (having spent over an hour cumulative waiting for connections from BART to MUNI).

I had offered to drive Roland back to Sunnyvale, where he was staying with a friend for the conference. After James showed up, said hello, and socialized for a bit, we started gathering to leave. "Hey, you have a car? Can you drive me to ...?" By the time we actually left the restaurant, I had 5 people in my car, ranging from a quick Haight dropoff, to Palo Alto, Mountain View and Sunnyvale (all of a mile from my house for the last two).

Sure, the car is expensive, non-environment friendly, big and sometimes annoying.

But it sure is convenient at 11:30 at night when you need to be 40 miles away from your current location.

HBD Drupal

Blog entry

Note to self: when you say happy birthday to a software product more often than you wish happy birthday to your family, either your priorities are wrong, or you're really really paranoid about your family's privacy.

Advice? Claim it's the latter and pat yourself on the back.

Ungrateful

Blog entry

An email came across the development list today (in the digest anyway), that, in a round about way, complained of the lack of instructions for some part of the system:

...
not only of external documention but of that oh-so-loved embedded in  
the code instructions for the image galleries settings --or should I  
say the NON-EXISTENT instructions.

There was another developer who started sending emails to the development list in a very aggressive manner, complaining that no one had instantly answered her questions, what kind of a support forum is this, she's not an idiot but she couldn't figure her problem out, why the hell isn't anyone answering questions, this product is crap.

Another organizer was at various developer meetups, talking about how great the project was, but it didn't have enough documentation. Someone needed to write documentation. Someone need to fix the bugs. Someone needed to help the new people. Someone should do it an do it now.

What is in common among the three of these people, aside from the fact they've complained about the project instead of (except for the first one) contributing to the project, is that they are all female. I'm not terribly sure why they're so aggressive in the community, it's entirely possible I'm just sensitive to the gender issue.

Personally, I find it annoying. I'm terribly less likely to help out someone who attacks what I'm working on as an introduction. I know I'm not the only one, either. A couple years ago at VA, when we were arranging desks and things, Mark commented to me he's more likely to seat Dom and Ariel in the good seats because they were very accomodating about seat preferences, versus some non-developers who were terribly insistent about where they "absolutely would not sit." I think Mark actually sat those people where they said they wouldn't sit. They sat there just fine.

Hey, so, check out my first contribution to the project. A better self-introduction to the development community than a rant or a you-should-do-this or a COMPLAINT about something being missing - do it yourself and stop complaining.

I crack myself up

Blog entry

Every since I had spent who-knows-how-long fighting with my original theme, I've been tempted to adjust my current theme regularly. I didn't until last month, and now I'm almost tempted to change them to match the upcoming holiday.

This one, for example, is so girly that I almost want to puke. Totally cracks me up! Ah, laughing about one's own website. The best!

Yay, CSS!

I'll probably leave this theme up until Valentine's Day, or until I actually do wretch from all the pink.

Pink! Mom tells me how, when I was a small person, I cried when she painted my room pink. I didn't want pink! Pink! PINK! PINK! The story cracks me up, because the first bedroom color I can be sure of is the white top, dark blue bottom colors of my room with the fan and the east facing window on Washington Street. Oooo! And the striped carpeting. And the Raggety Ann and Raggety Andy curtains!

I also slept in the front room at one point, but I can't tell you if the walls were green or grey or white or what.

Maybe if Mom logs in, she can tell me what colors those rooms were.

Yo! Gallery people!

Blog entry
Hi!

You're probably looking for my other site, which actually has some Drupal related stuff on it. I'll be writing up details of the whole PostNuke to Drupal conversion (including some of the pain Bharat went through with it), which is probably more of what you're interested in than my dogs, my ultimate game or my transistion from emacs to vi.

If you're a PostNuke person looking to transistion to Drupal, well, yeah, I'll get those details up, too.

You can contact me in the mean time, if you have specific Drupal/PostNuke/Gallery questions that I can answer.

I'm a night owl. Wanna see?

Blog entry
I think I'm a night owl. Actually, yeah, I am. Given that I hit my stride at 10pm, go to bed at 2am, and can't stand getting up before 10 am, I'd have to say yeah. And now I have the graphical proof to prove it!

At the bottom of the pages of Photo Matt, there's an image showing the post times on Matt's site.

Cool!

So, I searched for a bit to find the source to generate the image and the originator's site (Sanjay's Coding Tips - thanks, Sanjay!). Of course, the code is written for WordPress (i.e. not Drupal), so a little rewrite was needed. Well, that and installing GD. A couple hours and a bit of fudging later, and I now have a blog post time image. Whoo!

I haven't made the code robust enough for general consumption yet. If you want a copy, drop me a line and I'll send you the Drupal module.

Postnuke to Drupal Conversions: phpbb2.0 forums

Book page

Converting forums for phpbb2.0 to Drupal 4.5 forums. This is in a comment from http://drupal.org/node/12311.

# Forums
# Add the phpbb forum topics
#Replace XXX with the vid of the vocabularly you want to create, e.g., on a fresh drupal install, you can use "1" - otherwise, check your sequences table for the next available number
INSERT INTO vocabulary
VALUES (XXX, "Forum", "Topics for forums", "", 0, 1, 0, 1, "forum", -10);
# add the forum head topics by forum categories
#Replace YYY with the next available term data TID from your sequences table.
#For a fresh install, you can just delete "+ YYY". Replace XXX with the number you used above.
INSERT INTO term_data (tid, vid, name, description, weight)
SELECT cat_id + YYY, XXX, cat_title, cat_title, 0 FROM phpbb_categories;
#YYY same number as above or delete
INSERT INTO term_hierarchy (tid, parent)
SELECT cat_id + YYY, 0 FROM phpbb_categories;
# add the forum specific topics.
#Check your term_data table and find the highest TID number
#and replace ZZZ with a higher number.
#Use same XXX as above.
INSERT INTO term_data (tid, vid, name, description, weight)
SELECT forum_id + ZZZ, XXX, forum_name, forum_desc, 0 FROM phpbb_forums;
INSERT INTO term_hierarchy (tid, parent)
SELECT forum_id + ZZZ, cat_id + YYY FROM phpbb_forums;
#
# Create temporary tables for sorting topics and comments.
#
DROP TABLE IF EXISTS temp_posts;
CREATE TABLE temp_posts (
post_id mediumint(8) UNSIGNED NOT NULL auto_increment,
topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_id smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
poster_id mediumint(8) DEFAULT '0' NOT NULL,
post_time int(11) DEFAULT '0' NOT NULL,
post_edit_time int(11),
post_subject char(120),
post_text text,
PRIMARY KEY (post_id),
KEY forum_id (forum_id),
KEY topic_id (topic_id),
KEY poster_id (poster_id),
KEY post_time (post_time)
);
DROP TABLE IF EXISTS temp_node;
CREATE TABLE temp_node (
post_id mediumint(8) UNSIGNED NOT NULL auto_increment,
topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (post_id),
KEY topic_id (topic_id)
);
#
# Copy into temporary table topics without comments
#
INSERT INTO temp_node (post_id,topic_id)
SELECT MIN(post_id), topic_id
FROM phpbb_posts
GROUP BY topic_id;
INSERT INTO temp_posts (post_id, topic_id,forum_id,poster_id, post_time,post_edit_time,post_subject,post_text)
SELECT c.post_id, c.topic_id, a.forum_id, IF(a.poster_id='-1','0',a.poster_id), a.post_time, a.post_edit_time, REPLACE(b.post_subject, CONCAT(':',b.bbcode_uid),''), REPLACE(b.post_text, CONCAT(':',b.bbcode_uid),'')
FROM phpbb_posts AS a, phpbb_posts_text AS b, temp_node AS c
WHERE c.post_id=a.post_id AND c.post_id=b.post_id;
#
# Insert nid and tid from temp_posts into term_node
#
#check your node table and find the highest NID
#and replace WWW with a higher number.
#USe same ZZZ as above
INSERT INTO term_node (nid,tid)
SELECT WWW+topic_id,ZZZ+forum_id
FROM temp_posts;
ALTER TABLE term_node ORDER BY nid;
#
# Insert forum topics from temp_posts into node
#USe same WWW as above
INSERT INTO node (nid,type,title,uid,created,comment,body,changed)
SELECT WWW+topic_id,'forum',post_subject,poster_id,post_time,'2',post_text,IF(post_edit_time<>'NULL',post_edit_time,post_time)
FROM temp_posts;
ALTER TABLE node ORDER BY nid;
#
# Insert nid into forum
#Use same WWW and ZZZ as above
DELETE FROM forum;
INSERT INTO forum (nid,tid)
SELECT WWW+topic_id,ZZZ+forum_id
FROM temp_posts;
#
# Insert comments into comments for topics from temp_posts
#Use same WWW as above
INSERT INTO comments (nid,uid,subject,comment,hostname,timestamp,users)
SELECT WWW+a.topic_id,
CASE WHEN a.poster_id='-1' THEN '0' ELSE a.poster_id END,
REPLACE(c.post_subject, CONCAT(':',c.bbcode_uid),''),
REPLACE(c.post_text, CONCAT(':',c.bbcode_uid),''),
CONCAT_WS('.',CONV(SUBSTRING(a.poster_ip,1,2),16,10),CONV(SUBSTRING(a.poster_ip,3,2),16,10),CONV(SUBSTRING(a.poster_ip,5,2),16,10),CONV(SUBSTRING(a.poster_ip,7,2),16,10)),
a.post_time,'a:1:{i:0;i:0;}'
FROM phpbb_posts AS a LEFT JOIN temp_posts AS b ON a.post_id=b.post_id,phpbb_posts_text AS c
WHERE b.post_id IS NULL AND a.post_id=c.post_id;
ALTER TABLE comments ORDER BY cid;
UPDATE comments,node
SET comments.subject=IF(comments.subject='',CONCAT('Re:',node.title),comments.subject)
WHERE comments.nid=node.nid;
DROP TABLE IF EXISTS temp_posts;
DROP TABLE IF EXISTS temp_node;
#replace UUU with number higher than your highest current UID,
#or delete +UUU if this is fresh install
INSERT INTO users (uid+UUU,name,pass,mail,signature,timestamp,status,init,rid)
SELECT user_id,username,user_password,user_email,user_sig,IF(user_session_time='0',user_regdate,user_session_time),'1',user_email,'2'
FROM phpbb_users;
WHERE user_id>1
#replace WWW
INSERT INTO node_comment_statistics(
nid,
cid,
last_comment_timestamp,
last_comment_name,
last_comment_uid,
comment_count
)
SELECT
t.topic_id + WWW,
0,
t.topic_time,
p.username,
t.topic_poster,
t.topic_replies
FROM phpbb_topics t, users p
WHERE t.topic_poster = p.pn_uid;
#replace WWW
UPDATE node_comment_statistics n, phpbb_topics z SET
n.last_comment_timestamp = z.topic_last_post_id
WHERE n.nid = z.topic_id + WWW AND z.topic_last_post_id != 0;
UPDATE node_comment_statistics n, users z, phpbb_posts p SET
n.last_comment_name = z.username, n.last_comment_uid = z.uid
WHERE p.post_id = n.last_comment_timestamp and p.poster_id = z.uid;
UPDATE node_comment_statistics n, phpbb_posts p SET
n.last_comment_timestamp = p.post_time
WHERE p.post_id = n.last_comment_timestamp AND n.last_comment_timestamp != 0 ;
#
# Update Drupal variables
# This may not work and you ahve to update sequnces manually
SELECT @term_data_tid:=MAX(tid) FROM term_data;
SELECT @comments_cid:=MAX(cid) FROM comments;
SELECT @node_nid:=MAX(nid) FROM node WHERE type = 'forum';
SELECT @users_uid:=MAX(uid) FROM users;
UPDATE sequences SET id=@term_data_tid WHERE name='term_data_tid';
UPDATE sequences SET id=@comments_cid WHERE name = 'comments_cid';
UPDATE sequences SET id=@node_nid WHERE name = 'node_nid';
UPDATE sequences SET id=@users_uid WHERE name = 'users_uid';
#Now you have to install the Drupal BB code module AND the Drupal Quote Module, and you have to hack them:
#In the quote module replace function _quote_filter_process($text) with this:
function _quote_filter_process($text) {
// Quoting with or without specifying the source (code borrowed from bbcode.module)
// Thanks: function based on code from punbb.org
if (strpos($text, '[quote') !== false) {
$text = preg_replace('#\[quote=(?:"|"|\')?(.*?)["\']?(?:"|"|\')?\]#si', '
'.'\\1'." ".t("wrote:").'
', $text); $text = str_replace('[quote]', '
'.t("Quote:").'
', $text); $text = str_replace('[/quote]', '
', $text); $text = preg_replace('#\[quote:(.*?)=(?:"|"|\')?(.*?)["\']?(?:"|"|\')?\]#si', '
'.'\\2'." ".t("wrote:").'
', $text); $text = str_replace('[quote]', '
'.t("Quote:").'
', $text); $text = preg_replace('#\[/quote:(.*?)\]#', '
', $text); } return $text; } #In the BB code module, file bb-code-filter.inc, comment out the following lines: Quoting with or without specifying the source '#\[quote(?::\w+)?\](?:[\r\n])*(.*?)\[/quote(?::\w+)?\]#si' => '
'.$quote_text.':
\\1
', '#\[quote:(.*?)=(?:"|"|\')?(.*?)["\']?(?:"|"|\')?\](?:[\r\n])*(.*?)\[/quote(?::\w+)?\]#si' => '
'.$quote_user.':
\\2
',

PostNuke to Drupal Conversions: Basic conversion Reference

Book page
This is drawn from http://www.phrixus.net/migration, which at some point drew information from one of my Drupal comments and postnuke forums to drupal forums script.

That said, here's the original post:


Recently this website was migrated from PHP-Nuke to Drupal. Importing the data from one CMS to another presented a number of problems since the database tables are quite different.

The biggest difference is that Drupal treats everything as a 'node' and therefore uses one table for most entries. PHP-Nuke has separate tables for most sections of the site. Migrating the data from PHP-Nuke to Drupal requires that the table ids be changed to avoid conflicts. The trick is to keep all of the IDs relative to each other so the comments and other entries match up properly.

The following snippets are the MySQL code I used to migrate Phrixus from PHP-Nuke to Drupal. Each snippet is a separate file and they should be executed in the order in which they appear.

Executing these scripts as a file requires copying the contents into a file and running the following command:

$ mysql -p drupal < file.sql


Assumptions
  • The database names are 'drupal' and 'nuke'
  • The user doing the migration has full access to both databases.
  • The drupal database is empty aside from the entries created by database.mysql


Credits: Much of the following code was based on the PostNuke to Drupal migration scripts (pn2drupal.sql and pn2drupal_forums.sql) created by David Poblador Garcia and kitt (from drupal.org).

  1. Users
    The first step is to migrate all of the users.

    -- User Migration: PHP-Nuke to Drupal --

    -- Delete existing data --
    DELETE FROM drupal.users;

    INSERT INTO drupal.users
        ( uid, name, pass, mail, timestamp, status, init, rid )
      SELECT
        user_id, username, user_password, user_email, user_lastvisit, 1,
        user_email, 2
      FROM
        nuke.nuke_users ;


  2. Stories
    The next step is to migrate all of the stories and their associated comments.

    -- Story Migration --

    -- Delete existing vocabulary and terms --
    DELETE FROM drupal.vocabulary;
    DELETE FROM drupal.term_data;
    DELETE FROM drupal.term_hierarchy;

    INSERT INTO drupal.vocabulary VALUES
        ( 1, "Content", "Articles, blogs, and other short entry-based content",
          0, 1, 0, 1, "blog,poll,story", 0 );

    INSERT INTO drupal.term_data
        ( tid, vid, name, description, weight )
      SELECT
        topicid, 1, topicname, topictext, 0
      FROM
        nuke.nuke_topics;
     
    INSERT INTO drupal.term_hierarchy
        ( tid, parent )
      SELECT
        topicid, 0
      FROM
        nuke.nuke_topics;


    -- Migrate Stories --

    -- Delete existing nodes --
    DELETE FROM drupal.node;
    DELETE FROM drupal.term_node;

    INSERT INTO drupal.node
        ( nid, type, title, uid, created, comment, promote, teaser, body, changed )
      SELECT
        s.sid, "story", s.title, u.user_id, UNIX_TIMESTAMP(s.time), 2, 1,
        s.hometext,
        CONCAT(s.hometext, "", s.bodytext), now()
      FROM
        nuke.nuke_stories s, nuke.nuke_users u
      WHERE
        s.informant=u.username;
     
    INSERT INTO drupal.term_node
        ( nid, tid )
      SELECT
        s.sid, s.topic
      FROM
        nuke.nuke_stories s;

    -- Migrate Story Comments --

    DELETE FROM drupal.comments;

    INSERT INTO drupal.comments
        ( cid, pid, nid, uid, subject, comment, hostname, timestamp )
      SELECT
        c.tid, c.pid, c.sid, u.user_id, c.subject, c.comment, c.host_name,
        UNIX_TIMESTAMP(c.date)
      FROM
        nuke.nuke_comments c, nuke.nuke_users u
      WHERE c.name=u.username;


  3. Polls
    The next step is to migrate the polls. Since polls in Drupal are also considered nodes, some id offsets need to be set before this script is run.

    -- Migrate Polls --

    -- Make sure new polls don't conflict with existing NIDs --
    -- Use the following query to set the variable --
    -- SELECT MAX(sid) FROM nuke.nuke_stories --
    SET @POLL_NID_OFFSET=87;

    -- Make sure poll comments don't conflict with any existing CIDs --
    -- Use the following query to set the variable --
    -- SELECT MAX(tid) FROM nuke.nuke_comments  --
    SET @POLL_CID_OFFSET=368;


    -- delete any existing data --
    DELETE FROM drupal.poll;
    DELETE FROM drupal.poll_choices;

    INSERT INTO drupal.node
        ( nid, type, title, score, votes, uid, status, created, comment, promote,
          moderate, users, teaser, body, changed, revisions, static )
      SELECT
        pollID+@POLL_NID_OFFSET, "poll", pollTitle, 1, 1, 0, 1, timeStamp, 2, 1, 0,
        "", pollTitle, "", NOW(), "", 0
      FROM
        nuke.nuke_poll_desc;


    -- Migrate Polls --
    INSERT INTO drupal.poll
        ( nid, runtime, voters, active )
      SELECT
        pollID+@POLL_NID_OFFSET, timeStamp, voters, 1
      FROM
        nuke.nuke_poll_desc;

    INSERT INTO drupal.poll_choices
        ( chid, nid, chtext, chvotes, chorder )
      SELECT
        0, pollID+@POLL_NID_OFFSET, optionText, optionCount, voteID
      FROM
        nuke.nuke_poll_data;


    -- Migrate Poll Comments --

    INSERT INTO drupal.comments
        ( cid, pid, nid, uid, subject, comment, hostname, timestamp )
      SELECT
        c.tid + @POLL_CID_OFFSET, IF(c.pid, c.pid+@POLL_CID_OFFSET, 0),
        c.pollID+@POLL_NID_OFFSET, u.user_id, c.subject, c.comment, c.host_name,
        UNIX_TIMESTAMP(c.date)
      FROM
        nuke.nuke_pollcomments c, nuke.nuke_users u
      WHERE c.name=u.username;


  4. Forums
    The next step is the forums. This was the most difficult script to create since it alters so many different tables (nodes, comments, term_data, term_hierarchy, and vocabulary).

    -- Migrate Forums --

    -- Make sure new forum containers don't conflict with existing TIDs --
    -- Use the following query to set the variable --
    -- SELECT MAX(tid) FROM drupal.term_data --
    SET @FORUM_CONTAINER_OFFSET=5;

    -- Make sure new forums don't conflict with existing TIDs --
    -- Use the SUM of the following two queries to set the variable --
    -- SELECT MAX(tid) FROM drupal.term_data --
    -- SELECT COUNT(*) FROM nuke.nuke_bbcategories  --
    SET @FORUM_TERM_OFFSET=7;

    -- Make sure new forum topics don't conflict with existing NIDs --
    -- Use the following query to set the variable --
    -- SELECT MAX(nid) FROM drupal.node --
    SET @FORUM_NID_OFFSET=101;

    -- Make sure new forum comments don't conflict with existing CIDs --
    -- Use the following query to set the variable --
    -- SELECT MAX(cid) FROM drupal.comments --
    SET @FORUM_CID_OFFSET=418;

    -- Create a new vocabulary ID for forums --
    -- Use the following query to set the variable --
    -- SELECT MAX(vid)+1 FROM drupal.vocabulary --
    SET @FORUM_VID=2;


    -- delete existing data --
    DELETE FROM drupal.forum;
    DELETE FROM drupal.vocabulary WHERE vid=@FORUM_VID;

    -- Create the Forums --

    INSERT INTO drupal.vocabulary
        VALUES ( @FORUM_VID, "Forums", "Topics for forums", 0, 1, 0, 1,
                 "forum", 0 ) ;


    INSERT INTO drupal.term_data
        ( tid, vid, name, description, weight )
      SELECT
        cat_id + @FORUM_CONTAINER_OFFSET, @FORUM_VID, cat_title, cat_title, 0
      FROM
        nuke.nuke_bbcategories;


    INSERT INTO drupal.term_hierarchy
        ( tid, parent )
      SELECT
        cat_id + @FORUM_CONTAINER_OFFSET, 0
      FROM
        nuke.nuke_bbcategories;


    INSERT INTO drupal.term_data
        ( tid, vid, name, description, weight )
      SELECT
        forum_id + @FORUM_TERM_OFFSET, @FORUM_VID, forum_name, forum_desc, 0
      FROM
        nuke.nuke_bbforums;


    INSERT INTO drupal.term_hierarchy
        ( tid, parent )
      SELECT
        forum_id + @FORUM_TERM_OFFSET, cat_id + @FORUM_CONTAINER_OFFSET
      FROM
        nuke.nuke_bbforums;

       
    -- Add the forum topics (posts become comments to these) --

    INSERT INTO drupal.node
        ( nid, type, title, uid, status, created, comment, promote, moderate,
          users, teaser, body, changed, revisions, static )
      SELECT
        t.topic_id + @FORUM_NID_OFFSET, "forum", t.topic_title,
        t.topic_poster, 1, t.topic_time, 2, 1, 0, "",
        t.topic_title, t.topic_title, NOW(), "", 0
      FROM
        nuke.nuke_bbtopics t;


    INSERT INTO drupal.forum
        ( nid, tid )
      SELECT
        topic_id + @FORUM_NID_OFFSET, forum_id + @FORUM_TERM_OFFSET
      FROM
        nuke.nuke_bbtopics;

    INSERT INTO drupal.term_node
        ( nid, tid )
      SELECT
        topic_id + @FORUM_NID_OFFSET, forum_id + @FORUM_TERM_OFFSET
      FROM
        nuke.nuke_bbtopics;


    -- Add the forum posts as comments --

    INSERT INTO drupal.comments
        ( cid, pid, nid, uid, subject, comment, timestamp )
      SELECT
        c.post_id + @FORUM_CID_OFFSET, 0, c.topic_id + @FORUM_NID_OFFSET,
        c.poster_id, t.post_subject, t.post_text, c.post_time
      FROM
        nuke.nuke_bbposts c, nuke.nuke_bbposts_text t
      WHERE
        c.post_id=t.post_id;


  5. Journals
    PHP-Nuke has a journals module that I regrettably made use of. The journal section of PHP-Nuke was not well-designed especially with regard to the database schema. Because of this, the migration to drupal was not as smooth as it could have been despite being a very easy query to execute. The problem is that the PHP-Nuke journal table uses VARCHAR for its date fields instead of DATE. While it's possible these dates could be salvaged, I gave up after trying numerous queries. The following script migrates all of the journal content but sets a static date of Jan 01, 2003 for all journals.

    -- Migrate Journals to Personal Blog Entries --

    -- Make sure new journals (blogs) don't conflict with existing NIDs --
    -- Use the following query to set the variable --
    -- SELECT MAX(nid) FROM drupal.node --
    SET @JOURNAL_NID_OFFSET=179;

    INSERT INTO drupal.node
        ( nid, type, title, uid, status, created, comment, promote, moderate,
          users, teaser, body, changed, revisions, static )
      SELECT
        j.jid + @JOURNAL_NID_OFFSET, "blog", j.title, u.user_id, 1,
        UNIX_TIMESTAMP('2003-01-01'), 2, 1, 0, "", j.title, j.bodytext,
        UNIX_TIMESTAMP('2003-01-01'),"", 0
      FROM
        nuke.nuke_journal j, nuke.nuke_users u
      WHERE
        j.status='yes'
      AND
        j.aid=u.username;


  6. Private Messages
    The migration of private messages requires the use of the privatemsg module in Drupal.

    -- Migrate Private Messages --

    -- delete existing data --
    DELETE FROM drupal.privatemsg;

    INSERT INTO drupal.privatemsg
        ( id, author, recipient, subject, message, timestamp )
      SELECT
        p.privmsgs_id, p.privmsgs_from_userid, p.privmsgs_to_userid,
        p.privmsgs_subject, t.privmsgs_text, p.privmsgs_date
      FROM
        nuke.nuke_bbprivmsgs p, nuke.nuke_bbprivmsgs_text t
      WHERE
        t.privmsgs_text_id = p.privmsgs_id ;



  7. Sequences and Database Fixes
    The last step is to update the sequences table so new entries can be created and to fix some of the migration discrepancies that occurred.

    -- Fix some Nuke/Drupal discrepancies --

    -- Set the Drupal site admin username/uid here --
    SET @SITE_ADMIN='david';
    SET @SITE_ADMIN_NUKE_UID=2;

    -- Get the max IDs for various tables in order to update drupal.sequences --
    -- Use the following queries to set the variables --

    -- SELECT MAX(uid) FROM drupal.users --
    SET @MAX_UID=57;

    -- SELECT MAX(nid) FROM drupal.node --
    SET @MAX_NID=256;

    -- SELECT MAX(cid) FROM drupal.comments --
    SET @MAX_CID=947;

    -- SELECT MAX(vid) FROM drupal.vocabulary --
    SET @MAX_VID=2;

    -- SELECT MAX(tid) FROM drupal.term_data --
    SET @MAX_TID=16;
     

    -- PHP-Nuke has UID 1 as 'Anonymous'. Replace with the drupal site admin --
    DELETE FROM drupal.users WHERE uid='1';
    UPDATE drupal.users SET uid='1' WHERE name=@SITE_ADMIN;
    UPDATE drupal.node SET uid=1 WHERE uid=@SITE_ADMIN_NUKE_UID;
    UPDATE drupal.comments SET uid=1 WHERE uid=@SITE_ADMIN_NUKE_UID;
    UPDATE drupal.privatemsg SET author=1 WHERE author=@SITE_ADMIN_NUKE_UID;
    UPDATE drupal.privatemsg SET recipient=1 WHERE recipient=@SITE_ADMIN_NUKE_UID;
       
     
    -- Add the UID 0 so the drupal Anonymous user works properly --
    INSERT INTO drupal.users (uid,rid) VALUES (0,1);
       

    -- Update the sequences table so new entries can be created --
    INSERT INTO drupal.sequences (name, id) VALUES ('users_uid', @MAX_UID);
    INSERT INTO drupal.sequences (name, id) VALUES ('node_nid', @MAX_NID);
    INSERT INTO drupal.sequences (name, id) VALUES ('comments_cid', @MAX_CID);
    INSERT INTO drupal.sequences (name, id) VALUES ('vocabulary_vid', @MAX_VID);
    INSERT INTO drupal.sequences (name, id) VALUES ('term_data_tid', @MAX_TID);


Hopefully these scripts will be useful to others facing a similar situation. Just as note, these scripts do not come with any warranty and are not guaranteed to work. That said, they did work for my migration and with minimal tweaking should at least make a PHP-Nuke to Drupal migration easier.


End of post from other site.

PostNuke to Drupal Conversion: References

Book page

I managed my first conversion from PN to Drupal because of the help of others. In particular, the following helped me greatly:

A drupal node discussing the conversion process http://drupal.org/node/5871 references two other pages:

PostNuke to Drupal Conversion Process

Book page

Having done the conversion from PostNuke (723) to Drupal (4.4) for Gold Country Paddlers, I've been asked to do another conversion. Since the site is *significantly* larger than the GCP site (contrast: GCP was about 1000 entries when I converted it, the new conversion will be over 3800000 entries), I'll be running test cases and adjustable SQL scripts to do the conversion.

One of the requirements is that the site be offline for as short of a time as possible to do the final backend conversion. Some module development will also have to be done, as not all the PN modules are available in Drupal.

That said, here it the journey.

Pages