Importing & Migrating
  Stephanie Leary   sillybean.net   @sleary
Who am I?
• sillybean.net

• uwc.tamu.edu

• pagedmedia.com

• @sleary

• slideshare.net/
  stephanieleary
I’ve imported from...
• Blogger         • Joomla

• Movable Type    • Drupal

• Textpattern     • Twitter

• LiveJournal     • Gallery2

• WordPress.com   • HTML files

• CSV files       • OPML files
HTML Import
Gallery2 Importer
Secrets of
Happy Importing
Preparation
• Back up
• Prepare to undo
• Import on development server
 • Or turn on maintenance mode
• Turn off crossposting plugins
• Use absolute URLs for linked files
Plugins
• DB Backup
 http://wordpress.org/extend/plugins/wp-db-backup/

• Mass Page Remover
 http://wordpress.org/extend/plugins/mass-page-remover/

• WordPress Reset
 http://wordpress.org/extend/plugins/wordpress-reset/

• Maintenance Mode
 http://wordpress.org/extend/plugins/maintenance-mode/
WordPress export
• Posts, pages, comments, authors
• Uploads optional
• No settings
• No menus in 3.0 (fixed in 3.1)
• Category slug issues
• Skips users with no posts
Uncommon imports
• Twitter
  http://wordpress.org/extend/plugins/twitter-importer/

• CSV
  http://wordpress.org/extend/plugins/csv-importer/

• Gallery2
  http://wordpress.org/extend/plugins/gallery2-importer/

• HTML
  http://wordpress.org/extend/plugins/import-html-pages/
Uncommon imports
• Joomla 1.0-1.5
  http://tinyurl.com/joom2wp

• Drupal
 •   6.x to WP 2.7x: http://tinyurl.com/dru6wp2

 •   5.x to WP 2.3x: http://tinyurl.com/dru5wp2

• Other MySQL-based CMSs
  http://yoast.com/importing-from-another-mysql-into-wordpress/
Custom imports
• wp_insert_post() docs
  http://codex.wordpress.org/Function_Reference/
  wp_insert_post

• Build the new post array
• wp_insert_post( $newpost );
Character sets
• define('DB_CHARSET', 'utf8');
• Try to convert the old db
 • work with a copy!
 • Alter the table
   http://codesnippets.joyent.com/posts/show/306

 • Export Latin1, import UTF-8
   http://alexking.org/blog/2008/03/06/mysql-latin1-utf8-
   conversion
After importing
• Search & Replace
  http://wordpress.org/extend/plugins/search-and-replace/

• Redirection
  http://wordpress.org/extend/plugins/redirection/

• Add Linked Images to Gallery
  http://wordpress.org/extend/plugins/add-linked-images-
  to-gallery-v01/
Migrating Single
Installations into
    Networks
Second verse...
• Back up
• Prepare to undo
• Migrate on development server
XML or MySQL?
• XML pros         • MySQL pros

 • simple           • complete

 • limited          • complicated

 • slug bug         • merging users

 • skipped users    • manual edits
Moving databases
• export all tables except
  users, usermeta
• change table prefixes
• change wp_userroles option name
  to match new table prefix
Moving users
• Export users, usermeta
 • or specific rows
• Manually change IDs
• Stab yourself in the eye with a fork


• http://sillybean.net/?p=6187
After migrating
• Move static files
• Change upload file paths
  http://yoursite.com/wp-content/
  http://yoursite.com/files/

 • options
 • posts
 • theme files
Combining .htaccess
<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} ^us.tamu.edu$ [NC]

Redirect /forms.html http://us.tamu.edu/forms/ [R=301,NC]

RewriteCond %{HTTP_HOST} ^ppip.tamu.edu$ [NC]

Redirect /ppip/about/about.htm http://ppip.tamu.edu/
[R=301,NC]

</IfModule>
Thank you.
     Stephanie Leary
     sillybean.net
     @sleary

Importing & Migrating

  • 1.
    Importing & Migrating Stephanie Leary sillybean.net @sleary
  • 2.
    Who am I? •sillybean.net • uwc.tamu.edu • pagedmedia.com • @sleary • slideshare.net/ stephanieleary
  • 3.
    I’ve imported from... •Blogger • Joomla • Movable Type • Drupal • Textpattern • Twitter • LiveJournal • Gallery2 • WordPress.com • HTML files • CSV files • OPML files
  • 4.
  • 8.
  • 13.
  • 14.
    Preparation • Back up •Prepare to undo • Import on development server • Or turn on maintenance mode • Turn off crossposting plugins • Use absolute URLs for linked files
  • 15.
    Plugins • DB Backup http://wordpress.org/extend/plugins/wp-db-backup/ • Mass Page Remover http://wordpress.org/extend/plugins/mass-page-remover/ • WordPress Reset http://wordpress.org/extend/plugins/wordpress-reset/ • Maintenance Mode http://wordpress.org/extend/plugins/maintenance-mode/
  • 16.
    WordPress export • Posts,pages, comments, authors • Uploads optional • No settings • No menus in 3.0 (fixed in 3.1) • Category slug issues • Skips users with no posts
  • 17.
    Uncommon imports • Twitter http://wordpress.org/extend/plugins/twitter-importer/ • CSV http://wordpress.org/extend/plugins/csv-importer/ • Gallery2 http://wordpress.org/extend/plugins/gallery2-importer/ • HTML http://wordpress.org/extend/plugins/import-html-pages/
  • 18.
    Uncommon imports • Joomla1.0-1.5 http://tinyurl.com/joom2wp • Drupal • 6.x to WP 2.7x: http://tinyurl.com/dru6wp2 • 5.x to WP 2.3x: http://tinyurl.com/dru5wp2 • Other MySQL-based CMSs http://yoast.com/importing-from-another-mysql-into-wordpress/
  • 19.
    Custom imports • wp_insert_post()docs http://codex.wordpress.org/Function_Reference/ wp_insert_post • Build the new post array • wp_insert_post( $newpost );
  • 20.
    Character sets • define('DB_CHARSET','utf8'); • Try to convert the old db • work with a copy! • Alter the table http://codesnippets.joyent.com/posts/show/306 • Export Latin1, import UTF-8 http://alexking.org/blog/2008/03/06/mysql-latin1-utf8- conversion
  • 21.
    After importing • Search& Replace http://wordpress.org/extend/plugins/search-and-replace/ • Redirection http://wordpress.org/extend/plugins/redirection/ • Add Linked Images to Gallery http://wordpress.org/extend/plugins/add-linked-images- to-gallery-v01/
  • 22.
  • 23.
    Second verse... • Backup • Prepare to undo • Migrate on development server
  • 24.
    XML or MySQL? •XML pros • MySQL pros • simple • complete • limited • complicated • slug bug • merging users • skipped users • manual edits
  • 25.
    Moving databases • exportall tables except users, usermeta • change table prefixes • change wp_userroles option name to match new table prefix
  • 26.
    Moving users • Exportusers, usermeta • or specific rows • Manually change IDs • Stab yourself in the eye with a fork • http://sillybean.net/?p=6187
  • 27.
    After migrating • Movestatic files • Change upload file paths http://yoursite.com/wp-content/ http://yoursite.com/files/ • options • posts • theme files
  • 28.
    Combining .htaccess <IfModule mod_rewrite.c> RewriteEngineOn RewriteBase / RewriteCond %{HTTP_HOST} ^us.tamu.edu$ [NC] Redirect /forms.html http://us.tamu.edu/forms/ [R=301,NC] RewriteCond %{HTTP_HOST} ^ppip.tamu.edu$ [NC] Redirect /ppip/about/about.htm http://ppip.tamu.edu/ [R=301,NC] </IfModule>
  • 30.
    Thank you. Stephanie Leary sillybean.net @sleary