View Full Version : Drupal to vbDrupal conversion script
elmuerte
09-10-2006, 11:19 AM
Attached to this post is the first (test) version of the Drupal to vbDrupal conversion script.
The script is split up in two parts, a part that must be run from within the existing Drupal environment and a part that must be run from within a clean vBulletin installation.
This conversion will only work with a clean install of vBulletin (only tested it with 3.5 but there should be no issues with 3.6). If you already have an active vBulletin install you can't use this conversion script (since it will overwrite existing data where needed).
Haven't done much work on the documentation part yet. So here are the initial instructions:
Upgrade your current drupal install to 4.7.3
Download this script and place the "conversion" directory in the drupal directory and visit http://your.drupal.site/conversion to start the conversion.
Follow the instructions.
Be sure to remove the scripts after you completed the conversion.
Note: I finished this script not long before posting this thread. So I haven't done a lot of testing or validating. "It works for me". Ofcourse you should first test the whole conversion on a backup copy of your site first.
Update #1
I've fixed a couple of things in the conversion script. Most notably I fixed the bug when importing blocked users.
sifuhall
09-10-2006, 04:01 PM
I know many people have been wanting this.
This should be a great help for many.
david_iglobal
09-12-2006, 06:15 PM
Yes, itīs great to see the beggining of this script, but in my case (I own 4 important websites), I would need to make a convertion from an already being used Drupal and vBulletin. I canīt use a clean install.
david_iglobal
09-13-2006, 12:02 AM
Just one question, regarding this special module: will it be possible to convert an active Drupal website to an already active vBulletin forum? Thanks a lot.
As the script is now (I browsed the code), you need a clean install of vbulletin, as it overwrited all the users with the drupal users, and overwrites all forums with the drupal forums.
I would imagine that if you weren't using drupal forums, you could delete that portion.
As for the users, if you have been somehow syncing the two user bases you could ignore that part of the script as well. Or if not, you could modify it to check for username/userid conflicts before writing new the drupal members into the vbulletin db.
Most things are possible, with time. Unfortunetaly, I am only a drupal coder, not much in the way to knowing the insides of vbulletin, so hopefully elmuerte doesn't have to correct me too much.
elmuerte
09-13-2006, 02:54 PM
As gman said the script doesn't work (at all) for part 2 ( = importing the drupal users/forum) when you have an existing vbulletin. To make that work some more things need to be resolved.
Jelsoft's ImpEx should be able to do part 2 in that way, however ImpEx doesn't work for drupal 4.7 (it hardly works for 4.6.3). I may need help Jelsoft to fix this thing ;)
david_iglobal
09-13-2006, 06:56 PM
Thanks both for the great guides/tips. I am not interested about importing the users/forums from Drupal to vBulletin... what I need is to keep the exact URLīs of the original articles, and deal with the comments (either keeping them in vBdrupal or in vBulletin). The active users arenīt too many, so it would be easy to create a new account on vBulletin for each one in order to mantein the original author relation.
elmuerte
09-14-2006, 02:53 PM
Hmm... I think I can adjust the script to cope with that, more or less.
(just some pondering; and keeping a record of my thoughts on this subject)
I'll add a step to associate Drupal users with existing vBulletin users, or add a flag to create new vBulletin users based on the Drupal user. All content will be updated to receive the userid of the vBulletin user (*). The Drupal user table will be cleared and filled with the vBulletin users (like with a normal vbDrupal install happens).
(*) this might cause issues in case 3rd party drupal modules also store userids somewhere.
hmm... need to think about this a little more. Come to think of it, I might was well change the script to behave a bit like ImpEx (e.g. keeping track of so-called "import ids"). That would at solve issues related to forums and forum posts.
well.. that should be more than enough work to take up my spare time for the next couple of weeks.
mfizzel
09-20-2006, 10:12 AM
Will this work with drupal 4.6.3?
jvvlimme
09-21-2006, 07:50 AM
I followed all the steps, but when I try to create new content, I receive following error message:
* user warning: Duplicate entry '4-4' for key 1 query: INSERT INTO vb_drupal_node (nid, vid, title, type, uid, status, created, changed, comment, promote, moderate, sticky) VALUES (4, 4, 'test', 'blog', 1, 1, 1158844187, 1158844187, 2, 1, 0, 0) in /home/honden/public_html/includes/database.vbulletin.inc on line 95.
* user warning: Duplicate entry '4' for key 1 query: INSERT INTO vb_drupal_node_revisions (nid, vid, title, body, teaser, log, timestamp, uid, format) VALUES (4, 4, 'test', 'test', 'test', '', 1158844187, 1, 3) in /home/honden/public_html/includes/database.vbulletin.inc on line 95.
* user warning: Duplicate entry '4' for key 1 query: INSERT INTO vb_drupal_node_comment_statistics (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (4, 1158844187, NULL, 1, 0) in /home/honden/public_html/includes/database.vbulletin.inc on line 95.
* Created new alias test-2 for node/4
* Uw blog-item is aangemaakt.
I'm receiving the same error for about anything that requires the creation of entries in the database.
Ahhh, this is a sequence table issue. The table prefixes are used to as the index reference, and since they changed, the sequence table is messing up.
Elmuerte, I believe you will need to include a query that updates all the entries in the sequence table to append the vbulletin table prefix and/or the 'drupal_' prefix to all the entries in the sequences table.
To fix your problem, using phpmyadmin, you will need to browse the drupal_sequence table (or vb_drupal_sequence or whatever your vbulletin prefix is) and add the vbulletin and drupal prefix to each of those entries. So 'nid' for the node id# needs to become 'vb_drupal_nid' and so on for all the entries in the table.
If you have a multisite, then things may get more complicated, but if not I will end that discussion for now. -Gman
mfizzel
09-21-2006, 01:41 PM
When I get to the 2nd part of the conversion and I need to import users I get this error:
MySQL Error : Table 'admin_vb3.drupal_users' doesn't exist
the 'admin_vb3' is the vb database so I dont know why it would look there for a drupal_users table???
jvvlimme
09-22-2006, 12:22 AM
Gman: That fixed the problem. Many thanks.
mfizzel, since vbdrupal uses the database routines of vbulletin, they must exist inside the same database. So your config files for both vbulletin and vbdrupal must point to the same database to work.
andrew thomas
09-22-2006, 10:36 AM
Ahhh, this is a sequence table issue. The table prefixes are used to as the index reference, and since they changed, the sequence table is messing up.
Elmuerte, I believe you will need to include a query that updates all the entries in the sequence table to append the vbulletin table prefix and/or the 'drupal_' prefix to all the entries in the sequences table.
To fix your problem, using phpmyadmin, you will need to browse the drupal_sequence table (or vb_drupal_sequence or whatever your vbulletin prefix is) and add the vbulletin and drupal prefix to each of those entries. So 'nid' for the node id# needs to become 'vb_drupal_nid' and so on for all the entries in the table.
If you have a multisite, then things may get more complicated, but if not I will end that discussion for now. -Gman
ok im such a sql idiot sometime
i have the vbdrupal_sequence table
inside that i have 2 entries
name
id
inside name i have following rows
1 menu_mid
1 node_nid
1 node_revisions_vid
1 users_uid
1 vbdrupal_node_nid
1 vbdrupal_node_revisions_vid
inside id i have following rows
5 1
1 34
just to clearify
what exactly am i renaming here and what am i renaming to to?
peach
09-22-2006, 03:07 PM
not sure what your problem is, but most sequence table problems can be fixed by setting very high numbers on all the id's in the sequence table edntries.
This can be done be by manually editing all the seq table entries in phpmyadmin and setting the id's to 10000, 10001 etc.
Are you sure you have sequence table problems? Are you getting duplicate id or nid errors?
andrew thomas
09-22-2006, 03:18 PM
actually the biggets problem is the registration
users arent created in drupal through the VB registration
not only that i would much rather just use the drupal registration.
anyone here willing to do some work and chop up this code for me?
i figured out all the htaccess codes and they work fine
but what im hoping to do now is just leave the drupal registration intact and have my users register through drupal and also get created in yb
anyone could help?
For the first part, you need to add 'vbdrupal_' to each of the 'names' of each entry. So 'vbdrupal_menu_mid' is what you want.
When using vbdrupal, they most definitely should be created in drupal once they register in vbulletin. The other module, name 'drupalvb' does not accomplish that, but the product here of 'vbdrupal' sure does.
andrew thomas
09-22-2006, 03:47 PM
For the first part, you need to add 'vbdrupal_' to each of the 'names' of each entry. So 'vbdrupal_menu_mid' is what you want.
When using vbdrupal, they most definitely should be created in drupal once they register in vbulletin. The other module, name 'drupalvb' does not accomplish that, but the product here of 'vbdrupal' sure does.
i actually tried both products
but the vbdrupal here im having a problem getting users created in drupal when they register.
is there a way to use the drupal registration form and have it create users in both drupal and VB
ide pay $100 just for that option and i dont believe its so far fetched
andrew thomas
09-22-2006, 04:01 PM
for those more interested in maybe using the drupal profiles rather then the vb one which is better for community and myspace type websites IMO
RewriteCond %{QUERY_STRING} ^u=(.*)$
RewriteRule ^forum/member.php /user/%1 [L]
just add that code to your .htaccess file in ur site root dir and it should redirect all user ids accordingly to drupal assuming you did not convert user ids in drupal to usernames
elmuerte
09-23-2006, 10:38 AM
Will this work with drupal 4.6.3?
No. 4.6 has a completely different layout for nodes (all content has moved to a revision tables)
Elmuerte, I believe you will need to include a query that updates all the entries in the sequence table to append the vbulletin table prefix and/or the 'drupal_' prefix to all the entries in the sequences table.
Ah, will add that to the next version (which is currently under a major overhaul).
Currently I'm changing various things to the script. Most important of all, it will no longer be required to start with a clean vBulletin installation. I'm keeping track of the import IDs, this way existing data in vBulletin will be left alone. The only thing left is to update the drupal user table to set the new user ID (since user ids must match between drupal and vbulletin).
Just checking, will the change in user IDs mess up that node authors any, or will that be preserved somehow (doing a globel old uid to new uid on all the drupal tables). The drupal uid is used in workflows, authmaps, all voting moduels, blah blah. Sorry it being paranoid.
elmuerte
09-24-2006, 03:39 AM
Well yes, that's the main issue I'm trying to fix. My idea was to scan all drupal tables for "uid" fields and update them. But I also have to figure out how to perform this change without triggering key violations.
mfizzel
09-26-2006, 06:44 PM
i was able to get to the step where it imports drupal users into vbulletin....it went through the first 300 and then gave this error:
Fatal error: Unable to proceed with save while $errors array is not empty in class vb_datamanager_user in /includes/class_dm.php on line 763
elmuerte
09-27-2006, 01:35 PM
Error handling in the import script isn't great, they can be multiple causes for an error (like duplicate usernames). I really need to improve that.
mfizzel
09-29-2006, 10:50 PM
any prediction when the next release will be out?
my drupal site is just dyin' for vbulletin integration! :)
elmuerte
10-02-2006, 05:02 AM
uhm... 42
I haven't had much\any time for serious work in vbdrupal the past two weeks, and it's hard to tell how much spare time I have in the next weeks (but I think it's a bit more).
Anyway, for the new conversion script I still need to solve the last remaining major issue. Rewriting of user ids.
mfizzel ,
If you are going to move to a clean install of vBulletin, then the current conversion script will work for you already. We are trying to write up a more detailed set of instructions, but I have used it in a few test setup ups (with no glitches experienced).
mfizzel
10-02-2006, 09:27 AM
Gman,
I'm using a clean install of vB, but I still cant get the script to work...when importing the users I get the error I mentioned above:
Fatal error: Unable to proceed with save while $errors array is not empty in class vb_datamanager_user in /includes/class_dm.php on line 763
Grumbledook
10-09-2006, 09:22 AM
Just to be clear this will add all your registered drupal users to your new vbulletin board?
Gman,
I'm using a clean install of vB, but I still cant get the script to work...when importing the users I get the error I mentioned above:
Sorry I missed this post. This is a vbulletin error messages, which is not my strong suit (much better at Drupal troubleshooting). I hope elmuerte can give you some guidance.
Just to be clear this will add all your registered drupal users to your new vbulletin board?
Yes, that is exactly what it will do. It will also move any drupal forum entries that you have into the vbulletin forum.
elmuerte
11-11-2006, 12:46 PM
Attached is a much improved but even more experimental import script.
This will leave alone existing vbulletin data. It will in the end rewrite all (or at least I hope) drupal user data.
The whole importing of data should work correctly. It's just the updating of the Drupal user IDs which I'm not 100% sure about.
The drupal user table is updated correctly. But the updating of the uid's in other tables might be error prone. It will simply search for table columns with the name 'uid' and update the value with the new one.
A couple of things not yet taken care of:
vbulletin users are not imported into the drupal user table (but this can be done with the sync_user script)
url aliases are not updated, and I don't know if this would even be possible. It might be best to simply bulk update those aliases or something
So please test it out (on backup copies not on production sites) and let me know how if you hit a bump (or not).
cameron32
04-02-2007, 06:23 PM
Have there been any developments with the conversion script? I have a fully active Drupal site that I want to convert to vbDrupal. I have already installed vBulletin, but there are no users there yet. I have changed the templates, though.
I want to keep my existing Drupal site fully in tact, including highly custom templates. I haven't hacked my core code, though.
Drupal verion is 4.7.4 and vBulletin is 3.6.5
Any suggestions before I start installing test sites?
Thanks,
Cameron
elmuerte
04-03-2007, 04:36 AM
If you have a clean vBulletin installation you can simply use either version 2 or version 3 of the conversion script. (ofcourse first try it a mirror copy)
The development of the conversion script is on the backburner in favor of vbDrupal 5 development.
cameron32
04-05-2007, 02:42 PM
I'm using version 3 of the script, and I am at the point of "associate users" but I'm getting an error that the table drupal_users doesn't exist.
I have my vb and drupal tables in the same database, but there just isn't a drupal_users table. Did I miss something? How should I create this table? Dump the vbdrupal_users into a new table with that name, maybe?
cameron32
04-05-2007, 02:55 PM
by the way, when prefixing my tables, I prefixed them as vbdrupal_
Do I just need to alter drupalimport.php and replace drupal_users with vbdrupal_users ?
cameron32
04-05-2007, 03:46 PM
Ok, I replaced drupal_users with vbdrupal_users in drupalimport.php -- my next problem is that I am trying to import 2800 drupal users, and the script is choking. I changed SET_SIZE to 3000, but no more than 359 names import and then I get a "page cannot be displayed" error. Any suggestions?
I also have to clear out the vBulletin user table after each failed attempt, because if I try to import while there are any users in it, the script kicks out an error... so I can't just keep importing because the script won't pick up where it left off before.
*sigh*
cameron32
04-06-2007, 03:13 PM
Nothing has worked at all with this script in relation to the user tables. I even deleted all users except for the admin from each one, and it STILL doesn't work. On the importing missing users, I get this:
Importing missing users
0 missing users
Sorry, not implemented yet. Use the sync_users.php script
I know you're focused on the new version, but please realize that most people are going to find your product *after* they have an established drupal or vbulletin site and we *must have* a functional conversion script.