WordPress.org

Make WordPress Core

Ticket #4611: flatimport-tuto.html

File flatimport-tuto.html, 20.3 KB (added by albaran, 8 years ago)

in-line tutorial

Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<head>
5  <title>Tutorial Dotclear to WordPress 2.3+ (import migration)</title>
6  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
7  <link rel="stylesheet" type="text/css" href="flatimport.css" />
8  <script type="text/javascript" src="flatimport.js"></script>
9</head>
10
11<body onload="generate_TOC('toc');">
12<div id="pages">
13<h1>How to import a blog from Dotclear to WordPress 2.3+</h1>
14<p><em>modified july 26, 2007</em></p>
15<div id="toc"></div>
16<p>This importer import <strong>posts</strong> (users, comments, tags, categories), <strong>links</strong> (categories) into WordPress 2.3+ from a Dotclear export file.</p>
17<p>A restart procedure allows the import of big blogs.</p>
18<p>The importer with its tutorial is available <a href="http://cvie.free.fr/public/flatimport.zip">here</a>.</p>
19
20<h2>Requirements</h2>
21<ul>
22<li>from Dotclear version 1.2.3 to 1.2.7 or Dotclear 2 beta</li>
23<li>to WordPress 2.3+ ; UTF-8 is required</li>
24</ul>
25
26<h2>In Dotclear 1</h2>
27
28<ul>
29<li>If your Dotclear version is not 1.2.3 to 1.2.7 you must upgrade using
30the <a href="http://www.dotclear.net/download.html"><strong>Dotclear installer</strong></a>.</li>
31<li>You must install the flatexport plugin
32<ul>
33<li>for Dotclear 1.2.3 to 1.2.6 : download the <a href="http://cvie.free.fr/public/flatimport-addons.zip"><strong>flatimport add-ons</strong></a></li>
34<li>for Dotclear 1.2.7 : download the <a href="http://callmepep.org/downloads/dc1/plugins/plugin-flatExport-1.2+meta.tar.gz"><strong>flatexport plugin</strong></a></li>
35<li>uncompress the flatexport plugin using Windows XP or 7zip or Winzip or other,</li>
36<li>upload it into the <strong>flatExport directory</strong> to  have <em>dotclear/ecrire/tools/flatExport</em></li>
37</ul>
38</li>
39<li>In the admin panel, export your database
40<ul>
41<li>go to the <em>Flat file export</em> plugin</li>
42<li>click on <strong>Export my blog!</strong></li>
43<li>save the <strong>blog-backup.txt</strong> file on your local disk.</li>
44</ul>
45</li>
46</ul>
47
48<h2>In Dotclear 2</h2>
49
50<p>In the admin panel, export your database:</p>
51<ul>
52<li>choose the export <strong>all the content</strong> function to obtain the <strong>blog-backup.txt</strong> file,
53        <ul>
54        <li>this file contains all info, including users,</li>
55        <li>this is the option to select if you have only one blog.</li>
56        </ul>
57</li>
58<li>you can also try the export Blog function to obtain the default-backup.txt file (not recommended):
59        <ul>
60        <li>this file contains a part of the info related to one specific blog in a multiblog environment,</li>
61        <li>rename the <strong>default-backup.txt</strong> file to <strong>blog-backup.txt</strong>.</li>
62        </ul>
63</li>
64</ul>
65<p><strong>You have now saved the file</strong> <em>blog-backup.txt</em> <strong>into you local hard disk</strong>.</p>
66<p>Verify this <em>blog-backup.txt</em> file using an editor. Check for errors messages,
67if found see <em>When things goes wrong</em> below. Don't modify it or don't save it unless the editor is UTF-8 compliant.</p>
68<p><em>It is done with Dotclear !</em></p>
69
70<h2>In WordPress</h2>
71
72<p>Once a new WordPress is installed properly and if you are new to WordPress:</p>
73<ul>
74<li><strong>do not delete</strong> anything,</li>
75<li>keep WordPress brand new,</li>
76<li>the importer requires the first post (for orphans comments).</li>
77</ul>
78
79<p>If <strong>Dotclear flatimport</strong> is not within the list of the WordPress importers, use the package:</p>
80<ul>
81<li>extract the flatimport.php file and the tutorial files from the downloaded
82<a href="http://cvie.free.fr/public/flatimport.zip"><strong>flatimport.zip</strong></a> compressed file
83into a local directory, using a software such as Windows XP or 7zip or Winzip or other.</li>
84<li>upload the decompressed files into the <em>wp-admin/import</em>
85directory thru a FTP software such as CuteFTP, FileZilla&hellip;</li>
86<li>the <strong>Dotclear flat import</strong> entry must appear in the <em>Import</em> panel.</li>
87</ul>
88
89<p>The importer requires for an existing WordPress</p>
90<ul>
91<li>the first post <strong>ID 1</strong> ; <em>Hello World</em> initial name (for orphans comments),</li>
92</ul>
93<p>The <em>wp-content/uploads</em> directory must be available in read-write mode. It is used by
94the flatimport script to save the <strong>blog-backup-recovery.txt</strong> file when a point of control occurs.</p>
95<p>Note that an existing Dotclear user named <strong>admin</strong> is <strong>not</strong>
96imported, in order to protect the default WordPress <em>admin</em>.</p>
97<p><strong>Saving</strong> your existing WordPress data is <strong>mandatory</strong> before doing an import. The version 2 of
98<a href="http://www.ilfilosofo.com/blog/wp-db-backup">WordPress Database Backup</a> is recommended for WordPress 2.1.</p>
99
100<h3>Special install for embedded code (optional)</h3>
101<p>WordPress strips the &lt;embed&gt; &lt;object&gt; &lt;param&gt; tags and their contents. If you want to import
102the embedded code to display audio or video on your post, including the code from
103Google, DailyMotion, YouTube&hellip; and from 10 players, you have to modify the <strong>wordpress/wp-includes/kses.php</strong>
104file ; from:</p>
105<pre>
106if (!defined('CUSTOM_TAGS'))
107    define('CUSTOM_TAGS', false);
108// You can override this in your my-hacks.php file
109if (!CUSTOM_TAGS) {
110$allowedposttags = array (
111
112  'address' => array (),
113  &hellip;
114</pre>
115<p>to</p>
116<pre>
117if (!defined('CUSTOM_TAGS'))
118    define('CUSTOM_TAGS', false);
119// You can override this in your my-hacks.php file
120if (!CUSTOM_TAGS) {
121  $allowedposttags = array (<strong>
122        'embed' => array (
123                        'align' => array (),
124                        'allowfullscreen' => array (),
125                        'allowScriptAccess' => array (),
126                        'animationatstart' => array (),
127                        'animationstart' => array (),
128                        'autoplay' => array (),
129                        'autostart' => array (),
130                        'bgcolor' => array (),
131                        'console' => array (),
132                        'controller' => array (),
133                        'controls' => array (),
134                        'controltype' => array (),
135                        'data' => array (),
136                        'Displaysize' => array (),
137                        'filename' => array (),
138                        'flashvars' => array (),
139                        'height' => array (),
140                        'id' => array (),
141                        'name' => array (),
142                        'pluginspage' => array (),
143                        'quality' => array (),
144                        'showcontrols' => array (),
145                        'showdisplay' => array (),
146                        'showstatusbar' => array (),
147                        'src' => array (),
148                        'style' => array (),
149                        'transparentatstart' => array (),
150                        'type' => array (),
151                        'width' => array (),
152                        'wmode' => array ()
153                        ),
154                'object' => array (
155                        'classid' => array (),
156                        'codebase' => array (),
157                        'data' => array (),
158                        'height' => array (),
159                        'id' => array (),
160                        'standby' => array (),
161                        'type' => array (),
162                        'viewastext' => array (),
163                        'width' => array ()
164                        ),
165                'param' => array (
166                        'name' => array (),
167                        'value' => array ()
168                        ),
169                        </strong>
170
171        'address' => array (),
172  &hellip;
173</pre>
174<p>Note that the &lt;embed&gt; tag is a potential security hole. Watch it's content!</p>
175<p><i>Thanks to Matt (malandry) for the initial example.</i></p>
176
177<h3>Working with a new structure of directories</h3>
178<p>You will have to modify some tags within your posts if you change the location of referenced objects
179like images, documents, podcasts&hellip; in the new blog structure.</p>
180<p>You can either modify the <em>blog-backup.txt</em> file using an UTF-8 compliant editor
181or use the following importer change feature.</p>
182<p>Copy the <strong>blog-backup-change.php</strong> file within the flatimport-addons into the
183<em>/wp-content/uploads</em> directory, edit it to enter the existing URL's (old ones in the first <em>$post_old_strings</em> array)
184and the new ones in the <em>$post_new_strings</em> second array.
185The sample <em>blog-backup-change.php</em> to change URL's within posts follows:</p>
186<pre>
187&lt;?php
188# replacement strings for posts
189$post_old_strings = array(
190'http://site_dc.free.fr/share/video',
191'http://site_dc.free.fr/share/audio'
192);
193
194$post_new_strings = array(
195'http://www.site_wp.net/public/video',
196'http://www.site_wp.net/public/audio'
197);
198# end of replacement strings for posts
199?&gt;
200</pre>
201<p>Be careful, there is no validity check for the replacement strings, so you can use this feature to replace any string.</p>
202
203<h3>The import procedure</h3>
204<p>Prepare the import</p>
205<ul>
206<li>upload the <strong>blog-backup.txt</strong> file into the <em>/wp-content/uploads</em>
207directory thru a FTP software such as CuteFTP, FileZilla&hellip;</li>
208</ul>
209<p>Do the import</p>
210<ul>
211<li>in WordPress admin tool:
212        <ul>
213        <li>click the <strong>Import</strong> tab</li>
214        <li>select <strong>Dotclear flat import</strong></li>
215        <li>click the <strong>Import</strong> button</li>
216        </ul>
217</li>
218<li>Wait till the job is done, until the <strong>End of import</strong> message is displayed
219(it may take several minutes, please be patient).</li>
220</ul>
221<p><strong>Important:</strong> if you have a big blog-backup.txt file and if the screen
222freezes without no more messages or you have an error message, don't panic! You will have to <strong>retry</strong> the
223import procedure until the <strong>End of import</strong> message is displayed. The importer takes points of control and will restart the import from the latest one:</p>
224        <ul>
225        <li>click the <strong>Import</strong> tab</li>
226        <li>select <strong>Dotclear flat import</strong></li>
227        <li>click the <strong>Continue</strong> button</li>
228        </ul>
229<p><em>You have done it !</em></p>
230
231<h3>Import post-processing</h3>
232<p>Change the password for each user (except the <em>admin</em> one).</p>
233<p>Disable the rich text editor (wysiwyg) to work with the embedded code for <strong>video</strong>
234or <strong>audio</strong> provided by Google, DailyMotion, YouTube, players&hellip;</p>
235<ul>
236<li>Users => Your Profile.</li>
237<li>Scroll to the bottom.</li>
238<li>Uncheck the last checkbox. Save.</li>
239</ul>
240
241<h2>When things goes wrong</h2>
242
243<h3>Abnormal end</h3>
244<p>The import does not terminate without any message or you have a message like this one:</p>
245<pre>
246Internal Server Error
247The server encountered an internal error
248or misconfiguration and was unable to complete your request.
249Apache/ProXad [Oct 16 2006 22:55:06]
250Server at www.monsite.com Port 80
251</pre>
252<p>or this one:</p>
253<pre>
254Fatal error: Maximum execution time of nn seconds exceeded
255</pre>
256<p>The main cause is that the importer does not have enougth time to complete. Some servers limit
257the execution time to 30 seconds. You may need 1 to 3 seconds for 10 lines of the <strong>blog-backup.txt</strong> file.</p>
258<ul>
259<li><strong>retry</strong> the import using the <strong>Continue</strong> button (no need to return to a brand new WordPress, the importer takes care not having duplicates) ;
260there is a feature to restart the import from the last point of control (taken every 20 lines of a table),</li>
261<li>try the import at another hour, may be lighter load for the MySQL server,</li>
262<li>try to modify the following line in the <strong>flatimport.php</strong> file ;
263good luck if your server accepts this one:
264<pre>@ini_set('max_execution_time', 600);</pre>
265</li>
266</ul>
267
268<h3>Problems with the <strong>blog-backup.txt</strong> file</h3>
269<ul>
270<li>open the <strong>blog-backup.txt</strong> file with an UTF-8 compliant editor, verify that there are
271no errors messages. If yes:
272<ul>
273<li>use the modified importexport plugin for Dotclear 2 (mandatory for Free.fr servers)
274within the <a href="http://cvie.free.fr/public/flatimport-addons.zip">FlatImport add-ons</a>,</li>
275<li>see <em>Others</em> below</li>
276</ul>
277</li>
278<li>open the <strong>blog-backup.txt</strong> file with an UTF-8 compliant editor, the <em>///DOTCLEAR|</em> indicator
279must be on the first line. If not, delete the offending first lines.</li>
280</ul>
281<p>UTF-8 compliant editor: Notepad2, Notepad++,&hellip;.</p>
282
283<h3>Incomplete <strong>blog-backup.txt</strong> file</h3>
284<p>All posts, comments&hellip; 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:</p>
285<pre>@ini_set('max_execution_time', 1200);</pre>
286<p>or try to transfer your blog to a local one using <a href="http://www.wampserver.com/">WAMP5</a> for Windows for example, where the <em>@ini_set('max_execution_time', 1200);</em> is active ; using <a href="http://www.ozerov.de/bigdump.php">BigDump: Staggered MySQL Dump Importer</a> if needed.</p>
287<p>A ticket was open on this problem by a Dotclear developer. See the <a href="http://preview.dotclear.net/ticket/147">Ticket #147</a> for the latest information.</p>
288<p>Summary taken tuesday 2007-03-27:</p>
289<pre>
290DC2 timeline Ven, Mar 23, 2007 0:55
291Ticket #147 (defect created): import / export de gros blogs
292Reported by: biou
293Description : il serait intéressant d'avoir une interface ajax pour le plugin d'import/export,
294ainsi que pour le plugin flatexport de dc1, afin de contourner la limite du timeout php.
295(pep a des idées sur le sujet je crois)
296</pre>
297
298<h3>Problems with the recovery feature</h3>
299<p>You have several warning messages like this one</p>
300<pre>
301Warning: fwrite(): supplied argument is not a valid stream resource&hellip;
302</pre>
303<p>including the following one</p>
304<pre>
305Warning: fopen(&hellip;wp-content/uploads/blog-backup-recovery.txt): failed to open stream&hellip;
306</pre>
307<p>the flatimport script cannot create the <strong>blog-backup-recovery.txt</strong> file.
308The <em>uploads</em> directory <strong>must</strong> be available in read-write mode.
309You have to set it in this mode.</p>
310
311<h3>Problem with non-english characters</h3>
312<p>If you have problems with accentuated letters, for example, verify the following:</p>
313<ul>
314<li>WordPress was not installed with the UTF-8 option,</li>
315<li>the <strong>blog-backup.txt</strong> file was modified with a non UTF-8 compliant editor.</li>
316</ul>
317
318<h3>Others</h3>
319<ul>
320<li>Please ask your question (english is OK) in the
321<a href="http://www.wordpress-fr.net/support/viewtopic.php?id=2944">french Forum</a>
322(monitored by the author).</li>
323</ul>
324
325<h2>How to deal with new URL's</h2>
326<p>The import modify the posts ID's (for a given post the WordPress URL is not the same as the Dotclear one).
327Referencing the posts from your site in Google for example will be impacted.</p>
328<p>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 <em>301 status code: Moved Permanently</em> to the WordPress new links:</p>
329<pre>RewriteRule ^index.php[/]([0-9]+)[/]([0-9]+)[/]([0-9]+)[/][0-9]+-(.+)$ http://<strong>your_site_here</strong>/$1/$2/$3/$4 [R=301,L]</pre>
330<p>Change the <strong>your_site_here</strong> string to your site address, for examples <strong>64k.be</strong> ; <strong>www.egocyte.net</strong> &hellip;</p>
331
332<h3>Sources</h3>
333<ul>
334<li><a href="http://64k.be/2007/02/25/passer-de-dotclear-12-a-wordpress-21/">From Dotclear 1.2 to WordPress 2.1</a> ced french tutorial</li>
335<li><a href="http://www.emich.be/">RewriteRule from Mich</a></li>
336</ul>
337
338<h2>How to import pages</h2>
339<p>Pages as Dotclear 2 posts are imported directly. Other pages (external ones) as files in the <em>related</em> directory must be imported manually.</p>
340<p>A specific WordPress plugin must be used if there is some PHP code imbedded in the external content of the DC page.</p>
341<h3>Links</h3>
342<ul>
343<li><a href="http://codex.wordpress.org/Pages">WordPress Pages</a></li>
344<li><a href="http://codex.wordpress.org/fr:Pages">Pages WordPress</a></li>
345<li><a href="http://www.nosq.com/blog/2006/01/runphp-plugin-for-wordpress/">runPHP</a></li>
346<li><a href="http://redalt.com/Resources/Plugins/EzStatic/download/ezstatic">EzStatic</a></li>
347<li><a href="http://priyadi.net/archives/2005/03/02/wordpress-php-exec-plugin/">PhpExec</a></li>
348</ul>
349
350<h2>How to import images</h2>
351<p>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.</p>
352<h3>Links</h3>
353<ul>
354<li><a href="http://www.bloggingexpertise.com/plugins/cache-images/">Cache Images plugin for WordPress</a></li>
355<li><a href="http://www.2803.com/2007/03/20/wordpress-plugin-rapatrier-sur-votre-serveur-des-images-stokees-ailleurs">Rapatrier sur votre serveur des images stokées ailleurs</a></li>
356<li><a href="http://www.wordpress-fr.net/2007/03/22/plugin-de-la-semaine-cache-image/">Plugin de la semaine : Cache Image</a></li>
357</ul>
358<p>In the <a href="http://cvie.free.fr/public/flatimport-addons.zip">Add ons</a> you wil find a copy (version 1.3.2) of the Sarah modified Matt Mullenweg's plugin for WordPress 2. Check
359<a href="http://www.bloggingexpertise.com/plugins/cache-images/">Cache Images plugin for WordPress</a>
360for the last version.</p>
361
362<h2>Import versus update</h2>
363<p>The flatimport script allows you to do a first import then to re-import a more recent DotClear flatexport file.
364If you want to build your WordPress blog and continue to work with the Dotclear blog, use the <strong>Update</strong> to add new ones and update already ones. So you can update the WordPress blog with
365the latest data at migration time.</p>
366<p>If you want to work with the WordPress blog with real data, use the <strong>Import</strong> to add new ones only from Dotclear.</p>
367
368<h2>Users migrations and samples</h2>
369<h3>A user tutorial</h3>
370<p>How to migrate from Dotclear 1.2 to WordPress 2.1. See the french ced post: <a href="http://64k.be/2007/02/25/passer-de-dotclear-12-a-wordpress-21/">From Dotclear 1.2 to WordPress 2.1</a>.</p>
371
372<h3>Big import 1</h3>
373<p>A big import in 9 minutes for a 2 393 kB blog-backup.txt file (done with Wamp5 on a local computer
374with @ini_set('max_execution_time', 600); and $table_recover_count = 10;). One pass, no retry.</p>
375<pre>
376Import from Dotclear version: 1.2.5 - import format: 1.2
377Import of categorie : 12
378Import of link : 26
379Import of post : 627
380Import of comment : 934
381End of import. Read carefully the following page. Hit the finish button
382
383WordPress 2.0.5 — 518.18 secondes
384</pre>
385<p>This big import was also done using a Free.fr server with a 30 seconds of maximum execution time.
386This 30 seconds allows to import about 60 posts at a time. The whole import needed 10 manual retries.
387About 10 minutes to do the job.</p>
388
389<h3>Big import 2</h3>
390<p>Another big import made in local: 16 minutes total time.</p>
391
392WAMP5: installation of WordPress 2.1 fr + kses.php + UTWV<br />
393UTW activation<br />
394create /wp-content/uploads ; copy of a 10 255 KB default-backup.txt as uploads/blog-backup.txt<br />
395note that no category or user into this file<br /><br />
396
397copie 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);<br /><br />
398
399<pre>Import from Dotclear version: 2.0-beta5.4 - import format: 2.0
400
401Import of link : 15
402Warning: No categories found. All posts associated to catégorie ID 1
403Warning: No users found. All posts associated to admin
404Import of post : 2163
405No import for table post_media
406No import for table ping
407Import of comment : 6590
408UltimateTagWarriorCore class found. Importing tags.
409Import of meta : 3039
410Associate links to categories.
411End of import.
4122.1 — 925.05 secondes
413
414Tags are imported, the YouTube video is displayed.
415
416PHPMyAdmin:
4172143 posts
4186590 comments</pre>
419
420<h2>Links</h2>
421
422<ul>
423<li><a href="http://64k.be/2007/02/25/passer-de-dotclear-12-a-wordpress-21/">From Dotclear 1.2 to WordPress 2.1</a> ced french tutorial</li>
424<li><a href="http://cvie.free.fr/public/flatimport.zip">FlatImport PHP script and tutorials</a></li>
425<li><a href="http://cvie.free.fr/public/flatimport-addons.zip">FlatImport add-ons</a></li>
426<li><a href="http://www.wordpress-fr.net/support/viewtopic.php?id=2944">French Forum</a> english is OK</li>
427<li><a href="http://www.ilfilosofo.com/blog/wp-db-backup">WordPress Database Backup</a></li>
428<li><a href="http://www.ozerov.de/bigdump.php">BigDump: Staggered MySQL Dump Importer</a></li>
429</ul>
430
431<h2>Users</h2>
432<ul>
433<li><a href="http://www.christblog.eu/2006/11/21/how-to-import-your-dotclear-database-in-wordpress/">Christ’s Blog (beta-max)</a> <em>Thanks Christ for your memo-post</em></li>
434<li><a href="http://www.phocean.net/?p=32">Phocean.net</a></li>
435</ul>
436
437</div>
438</body>
439</html>