This tool supports migration of a WordPress blog to Drupal. It was derived from code by Claudio Bustos < clbustos {at} apsique dot com >.
It supports:
- Migration of the user database
- Migration of posts to selectable target node types (story, blog, page, etc.)
- Migration of post attributes, including draft, closed to comments, static, etc.
- Migration of post permalinks using the path module. The link format is not explicitly migrated, and must be manually configured in pathauto for continued consistent use
- Migration of comments
This has been used against WordPress 1.5 and Drupal 4.6.0, to migrate this very site.
To use it:
- Extract the archive anywhere, preferrably somewhere underneath your home directory.
- Edit wp_migrate/wp_migrate.php. Fill in the details about how to connect to the source WordPress database and the target Drupal database.
- Invoke the PHP command-line interpreter on wp_migrate/wp_migrate.php.
Notes:
- BACK UP YOUR DATA BEFORE USING THIS PROGRAM.
- For best results, start from a newly created Drupal database.
- The
$bDeleteAllflag can be used to scrub an existing Drupal installation. If it is set, an attempt will be made to destroy all content-related rows in your Drupal database. This includes all nodes, comments, vocabularies, path aliases, and cache and log entries. This should not affect anything else, including administrative settings and your user database. It may fail to clear state that is related to the deleted entries belonging to add-on modules. USE AT YOUR OWN RISK.
| Attachment | Size |
|---|---|
| wp_migrate.tgz | 13.29 KB |
Filed Under:
- Login to post comments
Wed, 2005-07-06 13:31
hi,
i want to use your migration script, however i am getting an error saying "Failed opening '../adodb/adodb.inc.php' for inclusion"
however when i look in the adodb folder, i do not see such a file -- they all have names like "adodb-" ("adodob-lib.inc.php", "adodob-php4.inc.php", etc)
i appreciate your help!
-j.chan
- Login to post comments
»Fri, 2005-10-28 10:41
cool blog :)
good luck
- Login to post comments
»Mon, 2005-07-11 07:32
Works like a charm, flawlessly took over all the content. Now I have to see whether the end-user prefers Drupal to Wordpress for their needs - which I fully expect.
This has saved me from a migration nightmare, thank you.
- Login to post comments
»Fri, 2005-08-05 22:42
Can this be used repeatedly or only once?
I have scripts running that update a (hidden) wordpress site and they are perfect for what they do. Migrating to the live drupal site is the hard part.
Can I use this to update the data or only for initial install? That is, will it check for duplicate nodes or just insert regardless?
-- Thanks in advance for your help.
- Login to post comments
»Sun, 2005-08-14 14:57
Is there any chance you would add support for a Drupal database table prefix in wp_migrate.php, like you did you for the WP database portion?
Thanks for your time,
Geoff
- Login to post comments
»Tue, 2005-08-23 21:20
Conect?ndose a WP por contenidos (mysql): SELECT id, user_login,user_pass,user_email,user_url,user_level FROM wp_users (mysql): SELECT ID,post_date,post_title,post_category, post_content,post_excerpt,post_name,post_author,post_status,comment_status FROM wp_posts ORDER BY post_date (mysql): SELECT cat_id,cat_name,category_nicename,category_description,category_parent from wp_categories (mysql): SELECT post_id,category_id FROM wp_post2cat (mysql): SELECT * from wp_comments Duplicate entry '' for key 2
thats what i get, and only two of my posts for wordpress are carried over. can anyone help?
- Login to post comments
»Wed, 2005-10-05 14:25
* from wp_comments Duplicate entry ” for key 2
I'm getting this too..
- Login to post comments
»Sun, 2005-10-09 16:52
...at which point the script starts importing posts as comments. I've blogged the details at my site.
- Login to post comments
»Mon, 2005-09-26 19:12
I'm able to connect to the database, but I keep getting this error after it selects the comments from wordpress:
Fatal error: Call to a member function execute() on a non-object in C:\Program Files\xampp\htdocs\drupal\engine.php on line 64Any ideas? I already placed the adodb folder in the same location as the wp_migrate.php script but it still doesn't work.
- Login to post comments
»Wed, 2005-09-28 21:52
I was finally able to make my script run. It didn't want to run on my local host but it worked perfectly on the target host. :)
to Brannon
I was able to use the same script thrice, porting three wp databases into one drupal database. (I wanted my three blogs to be accessed on just one drupal site.) It worked great! When doing this, (in wp_migrate.php) the first time you run it, set $bDeleteAll = true to delete existing entries in the target Drupal database. Set it to false for the succeeding databases after that. You might want to set $bPermalinkAlias = false as well if you have trouble importing the permalinks.
to Geoff
I was able to successfully import my wp databases to a drupal database that has a prefix. I just need to clean up my code and resubmit it in case anyone still wants to use the conversion into a prefixed Drupal database.
One last thing, for those who are using this script -- If you find yourself not able to post new items in drupal after using this script, update the entries in the SEQUENCES table. :)
Good luck everybody!
- Login to post comments
»Sun, 2005-11-27 11:18
When I am running the script I am getting
Column 'uid' cannot be null.
This error comes out on line 245 echo $db_dr->ErrorMsg();
Any ideas?
- Login to post comments
»Thu, 2005-12-15 19:28
Maybe you're trying to upgrade from the latest schema of wordpress (They've now moved "userlevel" field to a new table called "usermeta").
- Login to post comments
»Thu, 2005-12-08 04:56
It looks very likely that this will save my blog - my Wordpress install has decided that it doesn't want to let me login (I KNOW the password is correct because I set it in the database myself using phpmyadmin) - so thanks to this script I can just punch in my db details and get to it. Does it generate htaccess redirects or have I found something to spend my weekend doing :(
- Login to post comments
»Sat, 2005-12-17 18:45
I get this same error. It looks like I am almost succesful, but it chokes on the wp_comments import.
I'm using WP 1.5.2 and Drupal 4.6.5.
Anyone got a hint for me please?
These are the last details I see.
I thank anyone for help. I might receive.
"Conect?ndose a WP por contenidos (mysql): SELECT id, user_login,user_pass,user_email,user_url,user_level FROM wp_users (mysql): SELECT ID,post_date,post_title,post_category, post_content,post_excerpt,post_name,post_author,post_status,comment_status FROM wp_posts ORDER BY post_date (mysql): SELECT cat_id,cat_name,category_nicename,category_description,category_parent from wp_categories (mysql): SELECT post_id,category_id FROM wp_post2cat (mysql): SELECT * from wp_comments Column 'uid' cannot be null"
- Login to post comments
»Sun, 2006-01-01 05:19
I found this page extremely helpful for the issues outlned above: http://drupal.org/node/10900
Scroll down, and it explains how to get rid of that pesky error (the "Conect?ndose a WP por contenidos" one) - basically, just set $bPermalinkAlias in wp_migrate.php to 'false'. Hope this works for everyone else.
After this, works like a charm!
Thanks for saving me many, many hours with this script.
- Login to post comments
»Mon, 2006-01-09 15:14
Does this include the automatic htaccess writing that wp_goto_dr has? I really don't want to have to write almost 400 redirect codes myself :(
- Login to post comments
»Mon, 2006-01-23 01:58
I'm trying to use your script but I'm getting an accessed denied. Apparently it is parsing the '_' in my username that I've set as a '•' - I can't avoid having the '_'. any ideae what might be wrong?
- Login to post comments
»Tue, 2006-02-21 10:36
When I extract the wp_migrate.tgz file and unzip it, I only have one file within, wp_migrate. and i am also prompted to give this file an extension. So I type php before I can extract. When I finally extract, I don't see any of the other files referenced. What is wrong?
Thanks
- Login to post comments
»Wed, 2006-05-24 19:15
It sounds like you're looking at the directory itself. Change into that dir, and run the script.
- Login to post comments
»Wed, 2006-03-08 01:09
Congrats - this script remains the solution to beat for converting to Drupal from WordPress. Is development continuing on it? I'm especially interested given the recent upgrade to WordPress and the impending 4.7 version of Drupal.
- Login to post comments
»Fri, 2006-03-31 19:28
Hi there,
I tried to use this to migrate to a fresh install of Drupal 4.7 RC but the script gave me errors. Any plans to update? I'm sure that many people have appreciated this script in the past. Hopefully I can do so in the future!
Rick
PS - to help you, here is the error that I get when I run wp_migrate.php:
Conect?ndose a WP por contenidos
(mysql): SELECT id, user_login,user_pass,user_email,user_url,user_level FROM wp_users
(mysql): SELECT ID,post_date,post_title,post_category, post_content,post_excerpt,post_name,post_author,post_status,comment_status FROM wp_posts ORDER BY post_date
(mysql): SELECT cat_id,cat_name,category_nicename,category_description,category_parent from wp_categories
(mysql): SELECT post_id,category_id FROM wp_post2cat
(mysql): SELECT * from wp_comments
Unknown column 'teaser' in 'field list'
- Login to post comments
»Sat, 2006-04-01 15:05
As per some advice on Drupal.org, I am now using 4.6 for the import and I will then upgrade Drupal to 4.7.
However, I am still having issues with the transfer, which I am detailing here. I would appreciate any help that I can get at this moment! Take care, Rick
- Login to post comments
»Sat, 2006-04-15 22:41
Can the post meta be imported too. For instance, all my items have two custim fields which are stored in the posts2meta table. Can these be imported correctly?
- Login to post comments
»Sun, 2006-06-04 13:14
I´m thinking of using this script but I´m currently using:
/%year%/%monthnum%/%day%/%postname%/
for my permalinks. How will this interact with the .htaccess and is there a way to easily keep all of my current url names?
- Login to post comments
»Tue, 2006-07-18 03:28
Your site is great free ringtones
- Login to post comments
»Wed, 2006-07-19 05:06
any module that intregate drupal4.6.0 and wordpress(any version)
plz help me
- Login to post comments
»Tue, 2006-10-31 17:23
can you please help me by email in migrating from 2.0 to 4.7 because the other tool doesn't work?
thanks
bye
- Login to post comments
»