SlideShare a Scribd company logo

Tricky Migrations

Importing from unusual sources; migrating single installations into multisite networks.

1 of 33
Download to read offline
Tricky Migrations
Stephanie Leary   sillybean.net   @sleary
Who am I?
• sillybean.net

• @sleary

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

• Movable Type    • Drupal

• Textpattern     • Twitter

• LiveJournal     • Gallery2

• WordPress.com   • Delicious

• CSV files       • HTML files
HTML Import
Tricky Migrations
Tricky Migrations

Recommended

routes.rb をもう一度考えてみた #shibuyarb
routes.rb をもう一度考えてみた #shibuyarbroutes.rb をもう一度考えてみた #shibuyarb
routes.rb をもう一度考えてみた #shibuyarbToru Kawamura
 
Asset Pipeline
Asset PipelineAsset Pipeline
Asset PipelineEric Berry
 
WordPress Themes 101 - dotEduGuru Summit 2013
WordPress Themes 101 - dotEduGuru Summit 2013WordPress Themes 101 - dotEduGuru Summit 2013
WordPress Themes 101 - dotEduGuru Summit 2013Curtiss Grymala
 
Pragmatic plone projects
Pragmatic plone projectsPragmatic plone projects
Pragmatic plone projectsAndreas Jung
 
php (Hypertext Preprocessor)
php (Hypertext Preprocessor)php (Hypertext Preprocessor)
php (Hypertext Preprocessor)Chandan Das
 
誰でも作れるChrome拡張機能
誰でも作れるChrome拡張機能誰でも作れるChrome拡張機能
誰でも作れるChrome拡張機能Masato Koishi
 

More Related Content

What's hot

Rails 3 (beta) Roundup
Rails 3 (beta) RoundupRails 3 (beta) Roundup
Rails 3 (beta) RoundupWayne Carter
 
Apache2 BootCamp : Using Apache to Serve Static Content
Apache2 BootCamp : Using Apache to Serve Static ContentApache2 BootCamp : Using Apache to Serve Static Content
Apache2 BootCamp : Using Apache to Serve Static ContentWildan Maulana
 
Rails 6 Multi-DB 実戦投入
Rails 6 Multi-DB 実戦投入Rails 6 Multi-DB 実戦投入
Rails 6 Multi-DB 実戦投入kiyots
 
WordPress Themes 101 - HighEdWeb New England 2013
WordPress Themes 101 - HighEdWeb New England 2013WordPress Themes 101 - HighEdWeb New England 2013
WordPress Themes 101 - HighEdWeb New England 2013Curtiss Grymala
 
Developing CouchApps
Developing CouchAppsDeveloping CouchApps
Developing CouchAppswesthoff
 
OOP Adventures with XOOPS
OOP Adventures with XOOPSOOP Adventures with XOOPS
OOP Adventures with XOOPSxoopsproject
 
Architecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampArchitecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampDipen Chaudhary
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPressTaylor Lovett
 
Rails - getting started
Rails - getting startedRails - getting started
Rails - getting startedTrue North
 
Saving Time with WP-CLI
Saving Time with WP-CLISaving Time with WP-CLI
Saving Time with WP-CLITaylor Lovett
 
What's up with Drupal 7?
What's up with Drupal 7?What's up with Drupal 7?
What's up with Drupal 7?Gábor Hojtsy
 
XOOPS 2.6.0 Assets Management using Assetic
XOOPS 2.6.0 Assets Management using AsseticXOOPS 2.6.0 Assets Management using Assetic
XOOPS 2.6.0 Assets Management using Asseticxoopsproject
 
The JSON REST API for WordPress
The JSON REST API for WordPressThe JSON REST API for WordPress
The JSON REST API for WordPressTaylor Lovett
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDBOpusVL
 
Apache Any23 - Anything to Triples
Apache Any23 - Anything to TriplesApache Any23 - Anything to Triples
Apache Any23 - Anything to TriplesMichele Mostarda
 
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patternsStoyan Stefanov
 

What's hot (20)

Rails 3 (beta) Roundup
Rails 3 (beta) RoundupRails 3 (beta) Roundup
Rails 3 (beta) Roundup
 
Apache2 BootCamp : Using Apache to Serve Static Content
Apache2 BootCamp : Using Apache to Serve Static ContentApache2 BootCamp : Using Apache to Serve Static Content
Apache2 BootCamp : Using Apache to Serve Static Content
 
Rails 6 Multi-DB 実戦投入
Rails 6 Multi-DB 実戦投入Rails 6 Multi-DB 実戦投入
Rails 6 Multi-DB 実戦投入
 
WordPress Themes 101 - HighEdWeb New England 2013
WordPress Themes 101 - HighEdWeb New England 2013WordPress Themes 101 - HighEdWeb New England 2013
WordPress Themes 101 - HighEdWeb New England 2013
 
Developing CouchApps
Developing CouchAppsDeveloping CouchApps
Developing CouchApps
 
OOP Adventures with XOOPS
OOP Adventures with XOOPSOOP Adventures with XOOPS
OOP Adventures with XOOPS
 
Architecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampArchitecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal Camp
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
Rails - getting started
Rails - getting startedRails - getting started
Rails - getting started
 
Saving Time with WP-CLI
Saving Time with WP-CLISaving Time with WP-CLI
Saving Time with WP-CLI
 
What's up with Drupal 7?
What's up with Drupal 7?What's up with Drupal 7?
What's up with Drupal 7?
 
Apache poi
Apache poi Apache poi
Apache poi
 
Apache poi tutorial
Apache poi tutorialApache poi tutorial
Apache poi tutorial
 
XOOPS 2.6.0 Assets Management using Assetic
XOOPS 2.6.0 Assets Management using AsseticXOOPS 2.6.0 Assets Management using Assetic
XOOPS 2.6.0 Assets Management using Assetic
 
Liking performance
Liking performanceLiking performance
Liking performance
 
The JSON REST API for WordPress
The JSON REST API for WordPressThe JSON REST API for WordPress
The JSON REST API for WordPress
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDB
 
Apache Any23 - Anything to Triples
Apache Any23 - Anything to TriplesApache Any23 - Anything to Triples
Apache Any23 - Anything to Triples
 
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patterns
 
Scala with MongoDB
Scala with MongoDBScala with MongoDB
Scala with MongoDB
 

Similar to Tricky Migrations

What's New in WordPress 3.0 (for developers)
What's New in WordPress 3.0 (for developers)What's New in WordPress 3.0 (for developers)
What's New in WordPress 3.0 (for developers)Stephanie Leary
 
WordPress Tips and Tricks (DFW Meetup)
WordPress Tips and Tricks (DFW Meetup)WordPress Tips and Tricks (DFW Meetup)
WordPress Tips and Tricks (DFW Meetup)Stephanie Leary
 
Presentation to SAIT Students - Dec 2013
Presentation to SAIT Students - Dec 2013Presentation to SAIT Students - Dec 2013
Presentation to SAIT Students - Dec 2013Think Media Inc.
 
WordPress Café: Using WordPress as a Framework
WordPress Café: Using WordPress as a FrameworkWordPress Café: Using WordPress as a Framework
WordPress Café: Using WordPress as a FrameworkExove
 
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp MontrealCustom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp MontrealJoey Kudish
 
Starting WordPress Theme Review
Starting WordPress Theme ReviewStarting WordPress Theme Review
Starting WordPress Theme ReviewCatch Themes
 
WordPress
WordPressWordPress
WordPressrisager
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPOscar Merida
 
Multisite wp in education wc philly2011
Multisite wp in education wc philly2011Multisite wp in education wc philly2011
Multisite wp in education wc philly2011Paul Muller
 
Wordpress website development
Wordpress website developmentWordpress website development
Wordpress website developmentJohn Faust
 
Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)
Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)
Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)Andrew Duthie
 
The WordPress University 2012
The WordPress University 2012The WordPress University 2012
The WordPress University 2012Stephanie Leary
 
Wordpress beyond blogging
Wordpress beyond bloggingWordpress beyond blogging
Wordpress beyond bloggingJulien Minguely
 
WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1Yoav Farhi
 
Vibe Custom Development
Vibe Custom DevelopmentVibe Custom Development
Vibe Custom DevelopmentGWAVA
 
Modeling Tricks My Relational Database Never Taught Me
Modeling Tricks My Relational Database Never Taught MeModeling Tricks My Relational Database Never Taught Me
Modeling Tricks My Relational Database Never Taught MeDavid Boike
 
WordPress Theme and Plugin Optimization - WordPress Arvika March '14
WordPress Theme and Plugin Optimization - WordPress Arvika March '14WordPress Theme and Plugin Optimization - WordPress Arvika March '14
WordPress Theme and Plugin Optimization - WordPress Arvika March '14slobodanmanic
 

Similar to Tricky Migrations (20)

Importing & Migrating
Importing & MigratingImporting & Migrating
Importing & Migrating
 
What's New in WordPress 3.0 (for developers)
What's New in WordPress 3.0 (for developers)What's New in WordPress 3.0 (for developers)
What's New in WordPress 3.0 (for developers)
 
WordPress Tips and Tricks (DFW Meetup)
WordPress Tips and Tricks (DFW Meetup)WordPress Tips and Tricks (DFW Meetup)
WordPress Tips and Tricks (DFW Meetup)
 
Presentation to SAIT Students - Dec 2013
Presentation to SAIT Students - Dec 2013Presentation to SAIT Students - Dec 2013
Presentation to SAIT Students - Dec 2013
 
WordPress Café: Using WordPress as a Framework
WordPress Café: Using WordPress as a FrameworkWordPress Café: Using WordPress as a Framework
WordPress Café: Using WordPress as a Framework
 
Custom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp MontrealCustom Post Types in Depth at WordCamp Montreal
Custom Post Types in Depth at WordCamp Montreal
 
Starting WordPress Theme Review
Starting WordPress Theme ReviewStarting WordPress Theme Review
Starting WordPress Theme Review
 
The WordPress Way
The WordPress WayThe WordPress Way
The WordPress Way
 
WordPress
WordPressWordPress
WordPress
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
Multisite wp in education wc philly2011
Multisite wp in education wc philly2011Multisite wp in education wc philly2011
Multisite wp in education wc philly2011
 
Wordpress website development
Wordpress website developmentWordpress website development
Wordpress website development
 
Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)
Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)
Launching a WordPress Site 101 (Cincinnati WordPress, August 2015)
 
The WordPress University 2012
The WordPress University 2012The WordPress University 2012
The WordPress University 2012
 
Wordpress beyond blogging
Wordpress beyond bloggingWordpress beyond blogging
Wordpress beyond blogging
 
WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1
 
WordPress as a CMS
WordPress as a CMSWordPress as a CMS
WordPress as a CMS
 
Vibe Custom Development
Vibe Custom DevelopmentVibe Custom Development
Vibe Custom Development
 
Modeling Tricks My Relational Database Never Taught Me
Modeling Tricks My Relational Database Never Taught MeModeling Tricks My Relational Database Never Taught Me
Modeling Tricks My Relational Database Never Taught Me
 
WordPress Theme and Plugin Optimization - WordPress Arvika March '14
WordPress Theme and Plugin Optimization - WordPress Arvika March '14WordPress Theme and Plugin Optimization - WordPress Arvika March '14
WordPress Theme and Plugin Optimization - WordPress Arvika March '14
 

More from Stephanie Leary

Writing for the Web in Government and Education
Writing for the Web in Government and EducationWriting for the Web in Government and Education
Writing for the Web in Government and EducationStephanie Leary
 
Content Strategy for WordPress: Case Study
Content Strategy for WordPress: Case StudyContent Strategy for WordPress: Case Study
Content Strategy for WordPress: Case StudyStephanie Leary
 
Content Strategy for WordPress
Content Strategy for WordPressContent Strategy for WordPress
Content Strategy for WordPressStephanie Leary
 
There's a Plugin for That
There's a Plugin for ThatThere's a Plugin for That
There's a Plugin for ThatStephanie Leary
 
The WordPress University
The WordPress UniversityThe WordPress University
The WordPress UniversityStephanie Leary
 
WordPress Hidden Gems (July 2011)
WordPress Hidden Gems (July 2011)WordPress Hidden Gems (July 2011)
WordPress Hidden Gems (July 2011)Stephanie Leary
 
Social Media for Researchers
Social Media for ResearchersSocial Media for Researchers
Social Media for ResearchersStephanie Leary
 
WordPress as a CMS (short version)
WordPress as a CMS (short version)WordPress as a CMS (short version)
WordPress as a CMS (short version)Stephanie Leary
 

More from Stephanie Leary (14)

WordPress for the 99%
WordPress for the 99%WordPress for the 99%
WordPress for the 99%
 
Content First in Action
Content First in ActionContent First in Action
Content First in Action
 
Writing for the Web in Government and Education
Writing for the Web in Government and EducationWriting for the Web in Government and Education
Writing for the Web in Government and Education
 
Getting to WordPress
Getting to WordPressGetting to WordPress
Getting to WordPress
 
Content Strategy for WordPress: Case Study
Content Strategy for WordPress: Case StudyContent Strategy for WordPress: Case Study
Content Strategy for WordPress: Case Study
 
Content Strategy for WordPress
Content Strategy for WordPressContent Strategy for WordPress
Content Strategy for WordPress
 
There's a Plugin for That
There's a Plugin for ThatThere's a Plugin for That
There's a Plugin for That
 
Keeping It Simple
Keeping It SimpleKeeping It Simple
Keeping It Simple
 
The WordPress University
The WordPress UniversityThe WordPress University
The WordPress University
 
WordPress Hidden Gems (July 2011)
WordPress Hidden Gems (July 2011)WordPress Hidden Gems (July 2011)
WordPress Hidden Gems (July 2011)
 
WordPress Hidden Gems
WordPress Hidden GemsWordPress Hidden Gems
WordPress Hidden Gems
 
I'm with Stupid
I'm with StupidI'm with Stupid
I'm with Stupid
 
Social Media for Researchers
Social Media for ResearchersSocial Media for Researchers
Social Media for Researchers
 
WordPress as a CMS (short version)
WordPress as a CMS (short version)WordPress as a CMS (short version)
WordPress as a CMS (short version)
 

Tricky Migrations

  • 1. Tricky Migrations Stephanie Leary sillybean.net @sleary
  • 2. Who am I? • sillybean.net • @sleary • slideshare.net/ stephanieleary
  • 3. I’ve imported from... • Blogger • Joomla • Movable Type • Drupal • Textpattern • Twitter • LiveJournal • Gallery2 • WordPress.com • Delicious • CSV files • HTML files
  • 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 • Custom post types and taxonomies
  • 17. Uncommon imports • Twitter http://wordpress.org/extend/plugins/twitter-importer/ • Delicious http://wordpress.org/extend/plugins/delicious-xml-importer/ • Gallery2 http://wordpress.org/extend/plugins/gallery2-importer/ • HTML http://wordpress.org/extend/plugins/import-html-pages/
  • 18. Uncommon imports • Joomla/Mambo • 1.0 to WP 2.7x: http://tinyurl.com/joom2wp • 1.5 to WP 3.0x: http://wordpress.org/extend/plugins/ joomla-15-importer/ • Drupal • 6.x to WP 2.7x: http://tinyurl.com/dru6wp2 • 5.x to WP 2.7x: http://tinyurl.com/dru5wp2 • CSV http://wordpress.org/extend/plugins/csv-importer/
  • 19. Custom imports • Other MySQL-based CMSs http://yoast.com/importing-from-another-mysql-into-wordpress/ http://codex.wordpress.org/Function_Reference/wp_insert_post/ 1. Fetch data from old database 2. Build $post array 3. wp_insert_post ( $post );
  • 20. while ($row = mysql_fetch_array($results,MYSQL_ASSOC)) { $post = array(); $post[ 'post_status' ] = 'draft'; $post[ 'post_author' ] = $row[ 'user' ]; $post[ 'post_date' ] = $row[ 'date' ]; $post[ 'post_title' ] = $row[ 'title' ]; $post[ 'post_content' ] = $row[ 'content' ]; wp_insert_post( $post ); }
  • 21. Writing an import plugin • Import class • class Gallery2_Import extends WP_Importer • form: greet() • get posts: get_posts() • clean up & insert: process_posts()
  • 22. 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/
  • 23. Single Install ↓ Network
  • 24. Second verse... • Back up • Prepare to undo • Migrate on development server
  • 25. XML or MySQL? • XML pros • MySQL pros • simple • complete • limited • complicated • slug bug • merging users • skipped users • manual edits
  • 26. Moving databases • export all tables except users, usermeta • change table prefixes • change wp_userroles option name to match new table prefix • change wp_* fields in wp_usermeta table to match prefix
  • 27. Moving user tables • Export users, usermeta • or specific rows • Manually change IDs • Stab yourself in the eye with a fork • http://sillybean.net/?p=6187
  • 28. Compromise • Use WordPress export to move content and taxonomies • Have it create or map new users • Move only the wp_options table by hand
  • 29. Character sets • define('DB_CHARSET', 'latin1'); • 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
  • 30. After migrating • Move static files • Change upload file paths http://yoursite.com/wp-content/ http://yoursite.com/files/ • options • posts • theme files
  • 31. Combining .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^one.foo.com$ [NC] Redirect /forms.html http://one.foo.com/forms/ [R=301,NC] RewriteCond %{HTTP_HOST} ^two.foo.com$ [NC] Redirect /about.html http://two.foo.com/about/ [R=301,NC] </IfModule>
  • 32. ?
  • 33. Thank you. Stephanie Leary sillybean.net @sleary

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. I&amp;#x2019;m not going to talk much about the HTML import plugin because I&amp;#x2019;d like to get to some other things today, but you can come find me tonight if you want to know whether it&amp;#x2019;ll work in your situation.\n
  6. \n
  7. \n
  8. \n
  9. \n
  10. Some importers ask you to upload a file. Others ask for credentials so they can fetch data from an external API. This one asks for database connection info. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. The older Joomla and Drupal import scripts haven&amp;#x2019;t been updated to work with WordPress 3, so you&amp;#x2019;ll need to grab an older version from the release archive, do your import, then upgrade.\n
  19. \n
  20. \n
  21. These are the three main parts of any import script. You might also have functions to fetch authors, comments, and anything else you need to pull out of your old database. The dispatch() function displays greet() and then moves on to import(), which calls all the other functions in turn. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n