PN -> XOOPS Conversion Template
Category : Hacks
Published by Boobtoob on 07-Aug-2002 18:51
Ok, you may be asking what is a PN to XOOPS conversion template, well, it copies the core data from Postnuke 7.13x tables to XOOPS RC 3.04 tables. Now, the template thing may be confusing as well. The reason I call it a template is that it's not a full fledged conversion script, just a hack that you can easily use to customize for your particular setup. This script is designed for new (and seasoned) PHP devs with a good SQL background.

NEVER RUN THIS SCRIPT ON A PRODUCTION SERVER!!!!! I developed this because I've finally had it with PN and their ADODB layer (not to mention being an XOOPS team member, duh) and dusted this thing off. Now, that you know somewhat what it does do, here's what it doesn't do, a full blown conversion. It just copies data from source PN tables and overwrites XOOPS table data. The reason for this is that PN like other Nukes are usually pretty heavily customized and there is only so much data that will transfer so, I took what I consider core data and copy them to a destination db/tables. xoops_users table xoops_banner table xoops_bannerclient table xoops_bannerfinish table xoops_bb_categories table xoops_comments table xoops_xoopsfaq_categories table xoops_xoopsfaq_contents table xoops_mylinks_cat table xoops_mylinks_links table xoops_mylinks_votedata table xoops_mylinks_text table xoops_priv_msgs table xoops_seccont table xoops_sections table xoops_stories table xoops_topics table Now, some things to realize here is that this script can be destructive to your new XOOPS setup (but leaves your PN setup alone) so, here's the steps I would take to convert from PN to XOOPS. 1. BACK EVERYTHING UP! Backup your existing PN tables with your favorite php script or jump to the command line and do a mysqldump. Next, backup all your PN files and either zip them or tar them. 2. Use the mysql dump and your PN backup to create a site on a development machine that you don't mind trashing (because you will). 3. Once you have your PN site running locally, install XOOPS RC3.04 locally and get that running as well. If you only have one db (I have two which you see in the script), your still fine since I HIGHLY recommend using different table prefixes for XOOPS than you did with your PN install. 4. Open the pn_convert.php up in your favorite editor. 5. Load your favorite php DB management script up locally and open your db so that you see the table structures. 6. Now, at the top of the script is a built in readme that has more directions on what to modify in this script to get it working properly I know, ugly but, it works great once you get the kinks out. I get one function at a time working which equals one table before moving on to the next. ALSO..... this script deletes the target XOOPS table data because, guess what, it's not what we want. We're moving PN data to XOOPS so, don't fret. Now, before you move your users table, use your DB script and find your PN webmaster/admin UID number. You'll need this for setting your XOOPS webmaster permissions. Once you have this UID and you can successfully copy data from PN to XOOPS users table, then edit the xoops_groups_users_link table and modify the record that a UID of 1 to your PN UID (only modify the UID, not the GROUPID). This will make it so that when you login to XOOPS with your PN admin id, your now an XOOPS admin and your free to set things up properly. Please don't ask me for support via email, use the forums and all of us (XOOPS community) will try to help you out. Remember, use this tool on a development box, not a production box. Once you have your local XOOPS site up and running, just reverse the db and xoops directory backup procedures and restore them to your live site remembering to set any cache permissions and things should work fine. If they don't, you still have a PN install in tact.