• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Tricky Migrations
 

Tricky Migrations

on

  • 2,846 views

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

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

Statistics

Views

Total Views
2,846
Views on SlideShare
2,807
Embed Views
39

Actions

Likes
2
Downloads
23
Comments
0

4 Embeds 39

http://phxwordcamp.com 18
http://valletmon.blogspot.com.es 15
http://valletmon.blogspot.com 5
http://valletmon.blogspot.it 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • I’m not going to talk much about the HTML import plugin because I’d like to get to some other things today, but you can come find me tonight if you want to know whether it’ll work in your situation.\n
  • \n
  • \n
  • \n
  • \n
  • 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
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • The older Joomla and Drupal import scripts haven’t been updated to work with WordPress 3, so you’ll need to grab an older version from the release archive, do your import, then upgrade.\n
  • \n
  • \n
  • 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
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Tricky Migrations Tricky Migrations Presentation Transcript

  • Tricky MigrationsStephanie 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
  • Gallery2 Importer
  • Secrets ofHappy 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• Custom post types and taxonomies
  • 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/
  • 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/
  • 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 database2. Build $post array3. wp_insert_post ( $post );
  • 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 );}
  • Writing an import plugin• Import class• class Gallery2_Import extends WP_Importer • form: greet() • get posts: get_posts() • clean up & insert: process_posts()
  • 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/
  • Single Install ↓ Network
  • 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• change wp_* fields in wp_usermeta table to match prefix
  • 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
  • Compromise• Use WordPress export to move content and taxonomies• Have it create or map new users• Move only the wp_options table by hand
  • 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
  • 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 OnRewriteBase /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>
  • ?
  • Thank you. Stephanie Leary sillybean.net @sleary