How to import a blog from Dotclear to WordPress 2.3+

modified july 26, 2007

This importer import posts (users, comments, tags, categories), links (categories) into WordPress 2.3+ from a Dotclear export file.

A restart procedure allows the import of big blogs.

The importer with its tutorial is available here.

Requirements

In Dotclear 1

In Dotclear 2

In the admin panel, export your database:

You have now saved the file blog-backup.txt into you local hard disk.

Verify this blog-backup.txt file using an editor. Check for errors messages, if found see When things goes wrong below. Don't modify it or don't save it unless the editor is UTF-8 compliant.

It is done with Dotclear !

In WordPress

Once a new WordPress is installed properly and if you are new to WordPress:

If Dotclear flatimport is not within the list of the WordPress importers, use the package:

The importer requires for an existing WordPress

The wp-content/uploads directory must be available in read-write mode. It is used by the flatimport script to save the blog-backup-recovery.txt file when a point of control occurs.

Note that an existing Dotclear user named admin is not imported, in order to protect the default WordPress admin.

Saving your existing WordPress data is mandatory before doing an import. The version 2 of WordPress Database Backup is recommended for WordPress 2.1.

Special install for embedded code (optional)

WordPress strips the <embed> <object> <param> tags and their contents. If you want to import the embedded code to display audio or video on your post, including the code from Google, DailyMotion, YouTube… and from 10 players, you have to modify the wordpress/wp-includes/kses.php file ; from:

if (!defined('CUSTOM_TAGS'))
    define('CUSTOM_TAGS', false);
// You can override this in your my-hacks.php file
if (!CUSTOM_TAGS) {
$allowedposttags = array (

  'address' => array (),
  …

to

if (!defined('CUSTOM_TAGS'))
    define('CUSTOM_TAGS', false);
// You can override this in your my-hacks.php file
if (!CUSTOM_TAGS) {
  $allowedposttags = array (
	'embed' => array (
			'align' => array (),
			'allowfullscreen' => array (),
			'allowScriptAccess' => array (),
			'animationatstart' => array (),
			'animationstart' => array (),
			'autoplay' => array (),
			'autostart' => array (),
			'bgcolor' => array (),
			'console' => array (),
			'controller' => array (),
			'controls' => array (),
			'controltype' => array (),
			'data' => array (),
			'Displaysize' => array (),
			'filename' => array (),
			'flashvars' => array (),
			'height' => array (),
			'id' => array (),
			'name' => array (),
			'pluginspage' => array (),
			'quality' => array (),
			'showcontrols' => array (),
			'showdisplay' => array (),
			'showstatusbar' => array (),
			'src' => array (),
			'style' => array (),
			'transparentatstart' => array (),
			'type' => array (),
			'width' => array (),
			'wmode' => array ()
			),
		'object' => array (
			'classid' => array (),
			'codebase' => array (),
			'data' => array (),
			'height' => array (),
			'id' => array (),
			'standby' => array (),
			'type' => array (),
			'viewastext' => array (),
			'width' => array ()
			),
		'param' => array (
			'name' => array (),
			'value' => array ()
			),
			

	'address' => array (),
  …

Note that the <embed> tag is a potential security hole. Watch it's content!

Thanks to Matt (malandry) for the initial example.

Working with a new structure of directories

You will have to modify some tags within your posts if you change the location of referenced objects like images, documents, podcasts… in the new blog structure.

You can either modify the blog-backup.txt file using an UTF-8 compliant editor or use the following importer change feature.

Copy the blog-backup-change.php file within the flatimport-addons into the /wp-content/uploads directory, edit it to enter the existing URL's (old ones in the first $post_old_strings array) and the new ones in the $post_new_strings second array. The sample blog-backup-change.php to change URL's within posts follows:

<?php
# replacement strings for posts
$post_old_strings = array(
'http://site_dc.free.fr/share/video',
'http://site_dc.free.fr/share/audio'
);

$post_new_strings = array(
'http://www.site_wp.net/public/video',
'http://www.site_wp.net/public/audio'
);
# end of replacement strings for posts
?>

Be careful, there is no validity check for the replacement strings, so you can use this feature to replace any string.

The import procedure

Prepare the import

Do the import

Important: if you have a big blog-backup.txt file and if the screen freezes without no more messages or you have an error message, don't panic! You will have to retry the import procedure until the End of import message is displayed. The importer takes points of control and will restart the import from the latest one:

You have done it !

Import post-processing

Change the password for each user (except the admin one).

Disable the rich text editor (wysiwyg) to work with the embedded code for video or audio provided by Google, DailyMotion, YouTube, players…

When things goes wrong

Abnormal end

The import does not terminate without any message or you have a message like this one:

Internal Server Error
The server encountered an internal error
or misconfiguration and was unable to complete your request.
Apache/ProXad [Oct 16 2006 22:55:06]
Server at www.monsite.com Port 80

or this one:

Fatal error: Maximum execution time of nn seconds exceeded

The main cause is that the importer does not have enougth time to complete. Some servers limit the execution time to 30 seconds. You may need 1 to 3 seconds for 10 lines of the blog-backup.txt file.

Problems with the blog-backup.txt file

UTF-8 compliant editor: Notepad2, Notepad++,….

Incomplete blog-backup.txt file

All posts, comments… are not within the export from Dotclear. The main cause is that the export script does not have enougth time to complete. Try to add the following line in the export script, at the beginning:

@ini_set('max_execution_time', 1200);

or try to transfer your blog to a local one using WAMP5 for Windows for example, where the @ini_set('max_execution_time', 1200); is active ; using BigDump: Staggered MySQL Dump Importer if needed.

A ticket was open on this problem by a Dotclear developer. See the Ticket #147 for the latest information.

Summary taken tuesday 2007-03-27:

DC2 timeline Ven, Mar 23, 2007 0:55
Ticket #147 (defect created): import / export de gros blogs
Reported by: biou
Description : il serait intéressant d'avoir une interface ajax pour le plugin d'import/export,
ainsi que pour le plugin flatexport de dc1, afin de contourner la limite du timeout php.
(pep a des idées sur le sujet je crois)

Problems with the recovery feature

You have several warning messages like this one

Warning: fwrite(): supplied argument is not a valid stream resource…

including the following one

Warning: fopen(…wp-content/uploads/blog-backup-recovery.txt): failed to open stream…

the flatimport script cannot create the blog-backup-recovery.txt file. The uploads directory must be available in read-write mode. You have to set it in this mode.

Problem with non-english characters

If you have problems with accentuated letters, for example, verify the following:

Others

How to deal with new URL's

The import modify the posts ID's (for a given post the WordPress URL is not the same as the Dotclear one). Referencing the posts from your site in Google for example will be impacted.

The following RewriteRule to be put in the .htaccess file for the blog allow all your links indexed by Google to be redirected permanently by the 301 status code: Moved Permanently to the WordPress new links:

RewriteRule ^index.php[/]([0-9]+)[/]([0-9]+)[/]([0-9]+)[/][0-9]+-(.+)$ http://your_site_here/$1/$2/$3/$4 [R=301,L]

Change the your_site_here string to your site address, for examples 64k.be ; www.egocyte.net

Sources

How to import pages

Pages as Dotclear 2 posts are imported directly. Other pages (external ones) as files in the related directory must be imported manually.

A specific WordPress plugin must be used if there is some PHP code imbedded in the external content of the DC page.

Links

How to import images

A specific WordPress plugin can be used to move the Dotclear images to the WordPress blog and replace the references to the old files with references to the new files.

Links

In the Add ons you wil find a copy (version 1.3.2) of the Sarah modified Matt Mullenweg's plugin for WordPress 2. Check Cache Images plugin for WordPress for the last version.

Import versus update

The flatimport script allows you to do a first import then to re-import a more recent DotClear flatexport file. If you want to build your WordPress blog and continue to work with the Dotclear blog, use the Update to add new ones and update already ones. So you can update the WordPress blog with the latest data at migration time.

If you want to work with the WordPress blog with real data, use the Import to add new ones only from Dotclear.

Users migrations and samples

A user tutorial

How to migrate from Dotclear 1.2 to WordPress 2.1. See the french ced post: From Dotclear 1.2 to WordPress 2.1.

Big import 1

A big import in 9 minutes for a 2 393 kB blog-backup.txt file (done with Wamp5 on a local computer with @ini_set('max_execution_time', 600); and $table_recover_count = 10;). One pass, no retry.

Import from Dotclear version: 1.2.5 - import format: 1.2
Import of categorie : 12
Import of link : 26
Import of post : 627
Import of comment : 934
End of import. Read carefully the following page. Hit the finish button

WordPress 2.0.5 — 518.18 secondes

This big import was also done using a Free.fr server with a 30 seconds of maximum execution time. This 30 seconds allows to import about 60 posts at a time. The whole import needed 10 manual retries. About 10 minutes to do the job.

Big import 2

Another big import made in local: 16 minutes total time.

WAMP5: installation of WordPress 2.1 fr + kses.php + UTWV
UTW activation
create /wp-content/uploads ; copy of a 10 255 KB default-backup.txt as uploads/blog-backup.txt
note that no category or user into this file

copie de flatimport # import dotclear 1.2.x or dotclear 2.0-beta into wordpress 2.1 - 19:15 19/02/2007 dans wp-admin/import avec @ini_set('max_execution_time', 1200);

Import from Dotclear version: 2.0-beta5.4 - import format: 2.0

Import of link : 15
Warning: No categories found. All posts associated to catégorie ID 1
Warning: No users found. All posts associated to admin
Import of post : 2163
No import for table post_media
No import for table ping
Import of comment : 6590
UltimateTagWarriorCore class found. Importing tags.
Import of meta : 3039
Associate links to categories.
End of import.
2.1 — 925.05 secondes

Tags are imported, the YouTube video is displayed.

PHPMyAdmin:
2143 posts
6590 comments

Links

Users