Getting your data into Drupal

Matt Corks | mvc | matt@koumbit.org

Agenda

Typical use cases

A quick history

Why not just write a quick script?

Feeds vs. Migrate 2.x

Feeds

Feeds Overview

Fetchers (data sources)

Core:
File, HTTP, PubSubHubbub
Contrib:
Feeds SQL, LDAP, Directory fetcher (to find new files), etc

Feeds Overview

Parsers (data normalization)

Core:
RSS, CSV, OPML, Sitemap
Contrib:
XPath Parser, Flicker, YouTube, WordPress, LDAP, etc

Feeds Overview

Processors (data storage in Drupal)

Core:
Nodes, taxonomy terms, users, feed nodes
Contrib:
Comments, commerce products, database tables

Feeds Tips

feeds_dbg() prints to /tmp/feeds_example_org.log when the feeds_debug variable is TRUE

Use a Feeds tamper 'Find replace REGEX' to import local images:

REGEX: @.*/(.*)@
Replacement: file:///path/to/feeds/images/$1

Feeds Tips

Use Feeds tamper's 'String to Unix timestamp' to import dates as node creation or modification times

Associate nodes with their translations using hook_feeds_after_import()

Use the Feeds XPath Parser module with the Chrome XPath Helper extension

Feeds Tips

Node reference field support: http://drupal.org/node/724536

Drush integration: http://drupal.org/node/608408

Feeds Demo

Migrate 2.x

Migrate 2.x Overview

Creating a Migrate Class

Creating a Migrate Class

Learning to use Migrate

  • Creates taxonomies and content types
  • Imports nodes, users, comments, terms from SQL & XML sample data

Migrate Demo

Questions?