Taking your site from Drupal 6 to Drupal 7

Preview:

DESCRIPTION

Presented at CapitalCam

Citation preview

Taking your site from Drupal 6 to

Drupal 7Tobby Hagler, Phase2 Technology

Overview• Modules incorporated into Drupal Core• How does this affect your work as a site maintainer• Why not just stay in Drupal 6?• How do I know when to upgrade• Migration vs. Upgrading• Tools to upgrade or migrate

Biggest changes between D6 and

D7• Theme changes• New templates such as html.tpl.php• Render arrays• Module changes• Database changes – DBTNG

Contrib modulesin Drupal Core

• CCK became Fields API• Imagecache became Image Styles• Tokens• Admin• jQuery UI• And many more – drupal.org/node/895314

How does thisaffect site

maintainers• Can keep the site’s look and feel to the average user• May encounter drastic shifts in modules and site

administration• Will possibly require retraining (for site editors,

content producers, etc)

Why not juststay in Drupal 6?

• New modules developed for Drupal 7 only• Focus shift to Drupal 8, support for Drupal 6

will dwindle to security updates.• Drupal 7 allows for bigger scale (database

replication, storage engines)

Know when it's time

• Don’t get left behind – Module development shifts to D7, D6 support will dwindle

• Site cruft – As a site ages, cruft keeps a site from being maintainable in its current state

Upgrading vs. Migration

• Determine how much of your site can easily be upgraded• Some modules have been deprecated, abandoned, or

replaced• Inventory your site• Know that some content must still be migrated (CCK, user

profiles, Image files)

What about my theme?

• Most likely, you’ll need to rebuild it• Converting themes from Drupal 6 to Drupal 7 –

drupal.org/node/254940• Render Arrays in Drupal 7 – drupal.org/node/930760• jQuery UI is in core now

What do I need?• Dev environment (vhosts or localhost)• SSH or FTP• MySQL access to create new databases• Drush – drupal.org/project/drush

Site inventory• Show-stoppers – required functionality• Next round upgrades – What’s used but not required?• A better way? – Context and Features• Nice-to-have or not worth the effort?• Alternative replacements – 3rd party plugins• Cut list – Identify site cruft

Site inventory:Show stoppers

• Check project page for 7.x version or core status• Consider dependency change• Look for upgrade paths or replacement modules• If missing, you’ll probably want to rebuild and migrate

Determineupgrade paths

• Drupal core always has an upgrade path – See UPGRADE.txt

• Many popular modules have upgrade paths• Some modules include documentation to

migrate to other modules

Replacedeprecated

modules• Nodewords is replaced with Metatags – no

backwards compatibility• Thickbox is replaced by Colorbox – a drop-

in replacement

Upgrade process• Find a way to quickly instantiate a copy• Backup and work on a new instance• Disable all contrib modules …and test• Upgrade Drupal core …and test• Upgrade contrib modules in order of importance to the

site …and test

Upgrade process:Core

• See drupal.org/node/570162• Set theme to a core theme• Disable all contrib modules• Remove settings.php• Copy 7.x over existing site• Run update.php• Upgrade CCK content

Upgrade process:CCK to Fields API

• See drupal.org/node/1144136• Install CCK 7.x• Admin > Structure > Migrate Fields• May need additional CCK-related modules• Test content and content types

Upgrade process:Contrib modules

• Download and install 7.x versions• Check project page for migration instructions• Drush is your friend• drush dl module• drush en module• drush updatedb

Additional toolsto help upgrade

• Upgrade Status and Upgrade Assist – drupal.org/project/upgrade_status

• Coder – drupal.org/project/coder• Module Builder – drupal.org/project/module_builder• Advanced Help – drupal.org/project/advanced_help

Or migrate...Sometimes the easiest thing is to rebuild the

site from scratch and migrate content and users

Security concerns• When migrating content, you risk exposing your

data to the outside world• Especially true with custom migration – using

XML/feeds to export data may be open to anyone• Best practice is to migrate from a local snapshot

of production

Tools to migrate• Migrate – drupal.org/project/migrate• Backup and Migrate –

drupal.org/project/backup_migrate• Custom development – sometimes to meet the needs

of your site, you’ll need to do some custom migration

Migrate includes:• API for building a complete migration• Drush commands that use Batch API• Migrate UI• Migrate Example – See how Migrate module is

implemented with a working example• Documentation – drupal.org/node/415260

Backup and Migrate

• Selectively choose database tables to migrate• Doesn’t handle relational data like User Profiles• Perfect for porting custom tables that won’t

change

Custom migration• Often, data must be exposed to pull content and users• Exportable data via Views• Feeds – import data in a variety of formats• Many contributed Feeds modules that extend Feeds’

parsing capabilities

Database connections

• Table prefixing in settings.php – ‘other_database.’ as a prefix

• Switch database connections with db_set_active() – watch for errors and Schema API caching

Database prefixing$databases['default']['default'] = array( 'prefix' => array( 'default' => '', 'users' => 'shared.', 'sessions' => 'shared.', 'role' => 'shared.', 'authmap' => 'shared.', ),);

Other considerations

• Security – don’t expose your data, especially users • PHP timeout and memory settings• Make backups and database dumps at every

milestone• drush sql-dump > backup.sql

Files migration• Backup and Migrate Files –

drupal.org/project/backup_migrate_files• Recent Files – drupal.org/project/recent_files• rsync• Drupal 7 introduces public and private files• drupal.org/documentation/modules/file

Questions?

Contactthagler@phase2technology 

@phase2tech703-548-6050

d.o: tobby

Recommended