Updating a drupal 6 website to drupal 7
Graham Brown - Drupal Site Builder
& 360 Degree Virtual Tour Photographer
graham@vaccinemedia.com
@vaccinemedia
User Profile on Drupal = vaccinemedia
Upgrading from Drupal 6 to Drupal 7 - How hard is it?
- Dependant on contrib modules
- Do all the Drupal 6 modules exist for Drupal 7?
- Site complexity
- Custom / bespoke modules need updating for Drupal 7
- New Drupal 7 modules may make older bespoke code obsolete
- Update / port the theme or re-write from scratch?
Sometimes it simpler / easier to start from scratch
Case example:
http://www.thebacillus.co.uk
- Simple website for a band in Manchester.
- Bespoke theme - not responsive
- Audio module - not secure
- Drupal 6 backend vs Drupal 7 backend upgrade
- Future proofing new features only in Drupal 7
- Simpler front end editing workflow for the band members
Start from scratch? But what about all the content?
- Can't use node export due to upgraded content using better field types / different field names
- Views attachment in Drupal 6 replaced by Eva in Drupal 7
- RSS feeds in Drupal 6 not easily customisable and make it difficult to output the path and date fields correctly
Solution?
- Perform a clean Drupal 7 install
- Quickly re-create the necessary content types
- Create XML feeds on the Drupal 6 website for each content type*
- Create Feeds importers on the Drupal 7 to consume the content*
- Migrate over the content
*(after installing dependancies)
Module Dependancies
Drupal 6:
Views Data Export (6.x-2.x-dev)
(https://drupal.org/project/views_data_export)
Drupal 7:
Feeds (plus dependancies)
(https://drupal.org/project/feeds)
Feeds XPath Parser
(https://drupal.org/project/feeds_xpathparser)
Content types?
You can use Bundle Copy
(https://drupal.org/project/bundle_copy)
Bundle Copy is in Drupal 8 Core CMI!
Has export/import support for:
- Node types
- Taxonomy
- User
- Field API fields
- Field groups
Drupal 6: Create the xml feeds
- Create a new node view with published content = Yes
- Add fields for each field you want to migrate e.g.
- Uid, Nid, Post Date, Path, Title, Body, Tags etc..
- Make sure that the Title field and any other fields don't link to the content or that will output them as links in the XML feed too
Drupal 6: Creating the XML Feeds
Add a "Data Export" display type
Give the feed a path e.g. /feeds/content-type/all
Under style settings choose "XML file"
Uncheck "Provide as file"
Check "Transform Spaces" with a type of "Dash"
Drupal 6: Create the XML feeds
Paths
For the Node:path field (if migrating):
Check "Rewrite the output of this field"
Rewrite the output as [path]
Drupal 6: Create the XML Feeds
Dates:
Rewrite the output as [created]
Choose custom date format and enter:
Y-m-d H:i:s O
Drupal 6: Preview the XML Feed
<?xml version="1.0" encoding="utf-8" ?>
<nodes>
<node>
<Uid>2</Uid>
<Nid>71</Nid>
<Path>/about/staff</Path>
<Post-date>2011-04-28 13:04:39 -0400</Post-date>
<Title>Our Staff</Title>
<Body><p>Our employees are brilliant! And attractive, too.</p></Body>
</node>
<node>
<Uid>2</Uid>
<Nid>81</Nid>
<Path>/about/location</Path>
<Post-date>2011-04-28 13:06:27 -0400</Post-date>
<Title>Our Location and Hours</Title>
<Body><p>More fascinating HTML goes here, including an <a href="http://mysite.gatech.edu/fakedirectory/pagename">absolute link</a> whose URL may need replaced if I am changing my site's Domain Name.</p></Body>
</node>
</nodes>
Drupal 7: Create the Feeds Importers
Basic Settings:
DRUPAL 7: CREATE THE FEEDS IMPORTERS
Fetcher
Leave it as it is on the default HTTP fetcher
DRUPAL 7: CREATE THE FEEDS IMPORTERS
HTTP Fetcher Settings:
Check "Auto detect feeds"
DRUPAL 7: CREATE THE FEEDS IMPORTERS
Parser:
DRUPAL 7: CREATE THE FEEDS IMPORTERS
Processor (skip XPath XML parser settings for now):
Leave as the Node processor
DRUPAL 7: CREATE THE FEEDS IMPORTERS
Node Processor Settings:
DRUPAL 7: CREATE THE FEEDS IMPORTERS
Field Mappings: Select XPath Expression for each and a destination.
DRUPAL 7: CREATE THE FEEDS IMPORTERS
XPath XML parser Settings:
Take a look at the generated XML feed on Drupal 6
The content is wrapped in a "node" tag which has a single parent of "nodes" so...
Context = //node
Now simply copy and paste the field names from the XML tags into the appropriate field mapping fields
Perform the Migration!
Beware:
Backup the destination website first
For multi user blogs import the users first:
Create an XML feed of users
Use the following patch: http://drupal.org/node/1570544
Use Feeds to import them
Multi-Value Fields (e.g. image gallery)
For multiple value fields use Feeds Tamper (https://drupal.org/project/feeds_tamper)
Use a views template views-view-field--fid.tpl.php file to output each value of the multi-value fields separated by comma / pipe (usually a comma)
Add a tamper on the field in the Feeds importer settings and "explode" on the separator you chose above (comma by default) to transform the single XML values into multiple values during the import
But wait there's more!
Use the same technology to create site-to-site synchronous data transfers using XML
Create feeds from one site to another using Views Data Export and Feeds XPath Parser
Import external feeds from third parties using XPath Parser
Create feeds for third parties using Views Data Export
It's not all about upgrading / migrating but can also be about INTEGRATING too :)
Any Questions?
Credits
Inspiration for migrating anything from / to anything was acquired from:
http://adellefrank.com/blog/how-to-migrate-content-from-drupal6-to-drupal7-with-feeds-module