SlideShare a Scribd company logo
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Migrate in Drupal 8
Moldcamp 2015 Alexei Gorobets (asgorobets) 31.05.2015
Alexei
Gorobets
drupal.org: asgorobets
email: asgorobets@gmail.com
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
What about you?
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Agenda.Today
01 Upgrade path overview
02 Migrate in Core, what’s there
03 Migrate API
04 Demo
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Drupal upgrade.
In 4 easy steps:
1. Get latest version of your current Drupal core.
2. Through next major version on top of your current
3. Run upgrade.php
4. PRAY
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Drupal upgrade.
Pros:
- No coding required
- Easy to run
- Basic Drupal core coverage
Cons:
- No support for contrib modules, not even CCK
- Not customizable
- No way to jump versions
- Clutter in database and a pleathora of bugs
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Drupal Migrate.
In 4 painful steps:
1. Develop a completely new website with same functionality from scratch
2. Create migration classes for all your entity types and bundles
3. Implement missing migrate support for contrib modules and contribute it
back to the community
4. Run migrations and PRAY
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Drupal Migrate.
Pros:
- Flexible and extendable Migrate API
- Available solutions for contrib modules
- No clutter in database, as database is new
- You can jump major versions
- Basic support for simplest mappings from UI
Cons:
- Considerable amount of coding is usually required
- No way to migrate configurations
- No warranties and no core and community support
Migrate module in D8
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Migrate in D8.
Migrate was completely rewritten and was merged in Drupal 8 core.
Migrate modules:
>migrate (core)
>migrate_drupal (core)
>migrate_update (contrib)
>migrate_plus (Migrate UI formerly - contrib)
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Migrate in D8.
Drupal to Drupal migrations allow:
>Content migration with predefined mappings
>Configurations migration is supported, thanks to CMI (Content Types, User
profile, fields with field settings, widget settings, formatter settings)
>Excellent support for i18n, both nodes and UI translations
>Migration of every variable from D6
>~100 migrations defined
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Migrate in D8.
What is in Drupal core now:
>Migrate API and Drupal 8 destination plugins
>Drupal 6 migrate path finalized, couple of bugs left
>Drupal 7 migration path started
>Drupal 8 migration path planned for future releases
>No interface for rollbacks, and idlist yet
Not yet there:
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Migration API.
Basically Drupal’s implementation of Extract-Transform-Load (ETL)
Phases:
Extract > source
Transform > process
Load > destination
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Plugins everywhere.
Migration API works with plugins. Drupal 8 has a lot of plugins and a common
plugin system. Think of it like Ctools plugins in D7 but sexier.
Source plugins - extract data. From DB, YAML, JSON, whatever you need
Process plugins - pipeline for data massaging. Can have unlimited number of
process plugins chained
Destination plugins - saves data in Drupal. Be it an entity, config or URL
alias
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Definition.
Migrations are defined as config entities.
id: d6_system_site
label: Drupal 6 site configuration
migration_groups:
- Drupal 6
source:
plugin: variable
variables:
- site_name
- site_mail
- site_slogan
- site_frontpage
- site_403
- site_404
- drupal_weight_select_max
- admin_compact_mode
process:
name: site_name
mail: site_mail
slogan: site_slogan
'page/front': site_frontpage
'page/403': site_403
'page/404': site_404
weight_select_max: drupal_weight_select_max
admin_compact_mode: admin_compact_mode
destination:
plugin: config
config_name: system.site
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Process pipeline
process:
format:
-
plugin: machine_name
source: name
-
plugin: dedupe_entity
entity_type: filter_format
field: format
length: 32
name: name
cache: cache
…
filters:
plugin: iterator
source: filters
key: @id
process:
id:
plugin: static_map
default_value: filter_null
source:
- module
- delta
map:
filter:
- filter_html
- filter_autop
- filter_url
- filter_htmlcorrector
- filter_html_escape
php:
- php_code
settings: settings
status:
plugin: default_value
default_value: true
Running migrations
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
With Drush and manifest.yml
File manifest.yml
# nodes
- d6_node
- d6_node_revision
- d6_node_type
- d6_view_modes
- d6_filter_format
- d6_field_instance_per_form_display
- d6_field_instance_widget_settings
- d6_field_formatter_settings
- d6_field_instance
- d6_field
- d6_field_settings
- d6_node_settings
…
- d6_cck_field_values:*
- d6_cck_field_revision:*
- d6_term_node_revision
- d6_term_node
- d6_vocabulary_entity_display
- d6_vocabulary_entity_form_display
- d6_vocabulary_field_instance
- d6_vocabulary_field
- d6_user
- d6_user_role
- d6_taxonomy_vocabulary
> drush migrate-manifest manifest.yml --legacy-db-url=mysql://user:password@host/dbname
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
With Migrate Upgrade
What if your data needs
some massaging?
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Simple massaging
function hook_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
if ($migration->id() == 'd6_filter_formats') {
$value = $source->getDatabase()->query('SELECT value FROM {variable} WHERE name = :name’,
array(':name' => 'mymodule_filter_foo_' . $row->getSourceProperty('format')))->fetchField();
if ($value) {
$row->setSourceProperty('settings:mymodule:foo', unserialize($value));
}
}
}
Advanced topics
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Plugin definition
/**
* Drupal 6 menu source from database.
*
* @MigrateSource(
* id = "d6_menu",
* source_provider = "menu"
* )
*/
class Menu extends DrupalSqlBase {
public function query() {
$query = $this->select('menu_custom', 'm')
->fields('m', array('menu_name', 'title', 'description'));
return $query;
}
public function fields() {
return array(
'menu_name' => $this->t('The menu name. Primary key.'),
'title' => $this->t('The human-readable name of the menu.'),
'description' => $this->t('A description of the menu'),
);
}
public function getIds() {
$ids['menu_name']['type'] = 'string';
return $ids;
}
}
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Load plugins
id: d6_cck_field_values
label: Drupal 6 field values
migration_groups:
- Drupal 6
load:
plugin: drupal_entity
bundle_migration: d6_node_type
source:
plugin: d6_cck_field_values
process:
nid:
plugin: migration
migration: d6_node
source: nid
destination:
plugin: entity:node
migration_dependencies:
required:
- d6_node
- d6_field_formatter_settings
- d6_field_instance_widget_settings
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Cckfield plugins/**
* @PluginID("openlayers_wkt")
*/
class OpenlayersCckField extends CckFieldPluginBase {
public function processField(MigrationInterface $migration) {
// The field would be geofield rather than link if it existed.
$process[0]['map'][$this->pluginId]['openlayers_wkt_widget'] = 'geofield';
$migration->mergeProcessOfProperty('type', $process);
}
public function processFieldWidget(MigrationInterface $migration) {
// The widget would be geofield rather than link if it existed.
$process['type']['map']['openlayers_wkt_widget'] = 'geofield_default';
$migration->mergeProcessOfProperty('options/type', $process);
}
public function getFieldFormatterMap() {
return [
'default' => 'geofield_default',
'openlayers_wkt' => 'geofield_default',
'openlayers_map_default' => 'geofield_default',
'hidden' => 'hidden',
];
}
public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'get',
'value' => 'openlayers_wkt',
];
$migration->mergeProcessOfProperty($field_name, $process);
}
}
Demo time!
Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis
Further study
https://www.drupal.org/project/examples
https://www.drupal.org/developing/api/8
https://api.drupal.org/api/drupal/8
https://www.drupal.org/list-changes
https://drupalize.me/blog/201409/unravelling-drupal-8-plugin-system
https://drupalize.me/blog/201408/preparing-drupal-8-psr-4-autoloading
https://www.drupal.org/documentation/administer/config
… and happy migrations!
Thank you

More Related Content

What's hot

Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
Nuvole
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend development
sparkfabrik
 
2007 Fsoss Drupal Under The Hood
2007 Fsoss Drupal Under The Hood2007 Fsoss Drupal Under The Hood
2007 Fsoss Drupal Under The Hood
James Walker
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentationyamcsha
 
Django in the Real World
Django in the Real WorldDjango in the Real World
Django in the Real World
Jacob Kaplan-Moss
 
CMake: Improving Software Quality and Process
CMake: Improving Software Quality and ProcessCMake: Improving Software Quality and Process
CMake: Improving Software Quality and ProcessMarcus Hanwell
 
Tycho - good, bad or ugly ?
Tycho - good, bad or ugly ?Tycho - good, bad or ugly ?
Tycho - good, bad or ugly ?
Max Andersen
 
How to be effective with JBoss Developer Studio
How to be effective with JBoss Developer StudioHow to be effective with JBoss Developer Studio
How to be effective with JBoss Developer Studio
Max Andersen
 
YAG - Yet Another Gallery
YAG - Yet Another GalleryYAG - Yet Another Gallery
YAG - Yet Another Gallery
Daniel Lienert
 
WebGUI Developers Workshop
WebGUI Developers WorkshopWebGUI Developers Workshop
WebGUI Developers Workshop
Plain Black Corporation
 
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
Exove
 
Build Amazing Add-ons for Atlassian JIRA and Confluence
Build Amazing Add-ons for Atlassian JIRA and ConfluenceBuild Amazing Add-ons for Atlassian JIRA and Confluence
Build Amazing Add-ons for Atlassian JIRA and Confluence
K15t
 
Architecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampArchitecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal Camp
Dipen Chaudhary
 

What's hot (13)

Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend development
 
2007 Fsoss Drupal Under The Hood
2007 Fsoss Drupal Under The Hood2007 Fsoss Drupal Under The Hood
2007 Fsoss Drupal Under The Hood
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentation
 
Django in the Real World
Django in the Real WorldDjango in the Real World
Django in the Real World
 
CMake: Improving Software Quality and Process
CMake: Improving Software Quality and ProcessCMake: Improving Software Quality and Process
CMake: Improving Software Quality and Process
 
Tycho - good, bad or ugly ?
Tycho - good, bad or ugly ?Tycho - good, bad or ugly ?
Tycho - good, bad or ugly ?
 
How to be effective with JBoss Developer Studio
How to be effective with JBoss Developer StudioHow to be effective with JBoss Developer Studio
How to be effective with JBoss Developer Studio
 
YAG - Yet Another Gallery
YAG - Yet Another GalleryYAG - Yet Another Gallery
YAG - Yet Another Gallery
 
WebGUI Developers Workshop
WebGUI Developers WorkshopWebGUI Developers Workshop
WebGUI Developers Workshop
 
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
 
Build Amazing Add-ons for Atlassian JIRA and Confluence
Build Amazing Add-ons for Atlassian JIRA and ConfluenceBuild Amazing Add-ons for Atlassian JIRA and Confluence
Build Amazing Add-ons for Atlassian JIRA and Confluence
 
Architecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal CampArchitecture of Drupal - Drupal Camp
Architecture of Drupal - Drupal Camp
 

Viewers also liked

Extending media presentation
Extending media presentationExtending media presentation
Extending media presentationAlexei Gorobets
 
Media management in Drupal @Moldcamp
Media management in Drupal @MoldcampMedia management in Drupal @Moldcamp
Media management in Drupal @MoldcampAlexei Gorobets
 
Dependency injection in Drupal 8
Dependency injection in Drupal 8Dependency injection in Drupal 8
Dependency injection in Drupal 8Alexei Gorobets
 
Создание дистрибутивов Drupal. Почему, зачем и как?
Создание дистрибутивов Drupal. Почему, зачем и как?Создание дистрибутивов Drupal. Почему, зачем и как?
Создание дистрибутивов Drupal. Почему, зачем и как?Alexei Gorobets
 
Real-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal with Elasticsearch @MoldcampReal-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal with Elasticsearch @MoldcampAlexei Gorobets
 
Migrating data to drupal 8
Migrating data to drupal 8Migrating data to drupal 8
Migrating data to drupal 8
Ignacio Sánchez Holgueras
 
Real-time search in Drupal. Meet Elasticsearch
Real-time search in Drupal. Meet ElasticsearchReal-time search in Drupal. Meet Elasticsearch
Real-time search in Drupal. Meet ElasticsearchAlexei Gorobets
 
Migrating to Drupal 8: How to Migrate Your Content and Minimize the Risks
Migrating to Drupal 8: How to Migrate Your Content and Minimize the RisksMigrating to Drupal 8: How to Migrate Your Content and Minimize the Risks
Migrating to Drupal 8: How to Migrate Your Content and Minimize the Risks
Acquia
 
Drupal 8 migrate!
Drupal 8 migrate!Drupal 8 migrate!
Drupal 8 migrate!
Andy Postnikov
 
Migrate to Drupal 8
Migrate to Drupal 8Migrate to Drupal 8
Migrate to Drupal 8
Claudiu Cristea
 

Viewers also liked (11)

Extending media presentation
Extending media presentationExtending media presentation
Extending media presentation
 
Media management in Drupal @Moldcamp
Media management in Drupal @MoldcampMedia management in Drupal @Moldcamp
Media management in Drupal @Moldcamp
 
Why drupal
Why drupalWhy drupal
Why drupal
 
Dependency injection in Drupal 8
Dependency injection in Drupal 8Dependency injection in Drupal 8
Dependency injection in Drupal 8
 
Создание дистрибутивов Drupal. Почему, зачем и как?
Создание дистрибутивов Drupal. Почему, зачем и как?Создание дистрибутивов Drupal. Почему, зачем и как?
Создание дистрибутивов Drupal. Почему, зачем и как?
 
Real-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal with Elasticsearch @MoldcampReal-time search in Drupal with Elasticsearch @Moldcamp
Real-time search in Drupal with Elasticsearch @Moldcamp
 
Migrating data to drupal 8
Migrating data to drupal 8Migrating data to drupal 8
Migrating data to drupal 8
 
Real-time search in Drupal. Meet Elasticsearch
Real-time search in Drupal. Meet ElasticsearchReal-time search in Drupal. Meet Elasticsearch
Real-time search in Drupal. Meet Elasticsearch
 
Migrating to Drupal 8: How to Migrate Your Content and Minimize the Risks
Migrating to Drupal 8: How to Migrate Your Content and Minimize the RisksMigrating to Drupal 8: How to Migrate Your Content and Minimize the Risks
Migrating to Drupal 8: How to Migrate Your Content and Minimize the Risks
 
Drupal 8 migrate!
Drupal 8 migrate!Drupal 8 migrate!
Drupal 8 migrate!
 
Migrate to Drupal 8
Migrate to Drupal 8Migrate to Drupal 8
Migrate to Drupal 8
 

Similar to Migrate in Drupal 8

Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7
Phase2
 
Drupal8 theming
Drupal8 themingDrupal8 theming
Drupal8 theming
hrisi87
 
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011camp_drupal_ua
 
Automating Drupal Migrations
Automating Drupal MigrationsAutomating Drupal Migrations
Automating Drupal Migrations
littleMAS
 
Drupal 8 migrate!
Drupal 8 migrate!Drupal 8 migrate!
Drupal 8 migrate!
Pavel Makhrinsky
 
Drupal 7 database api
Drupal 7 database api Drupal 7 database api
Drupal 7 database api
Andrii Podanenko
 
Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7
Phase2
 
Gestione della configurazione in Drupal 8
Gestione della configurazione in Drupal 8Gestione della configurazione in Drupal 8
Gestione della configurazione in Drupal 8
Eugenio Minardi
 
Debugging in drupal 8
Debugging in drupal 8Debugging in drupal 8
Debugging in drupal 8
Allie Jones
 
Migrating to Drupal 8
Migrating to Drupal 8Migrating to Drupal 8
Migrating to Drupal 8Alkuvoima
 
Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8
Angela Byron
 
Drupal vs WordPress
Drupal vs WordPressDrupal vs WordPress
Drupal vs WordPress
Walter Ebert
 
Design systém 1.0
Design systém 1.0Design systém 1.0
Design systém 1.0
Adam Kudrna
 
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
Eric Sembrat
 
Drupal8 migrate
Drupal8 migrateDrupal8 migrate
Drupal8 migrate
John Doyle
 
Drupal Module Development
Drupal Module DevelopmentDrupal Module Development
Drupal Module Development
ipsitamishra
 
Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010
Siva Epari
 
Drupal @ MediaCamp Athens
Drupal @ MediaCamp Athens Drupal @ MediaCamp Athens
Drupal @ MediaCamp Athens
Nektarios Sylligardakis
 
Upgrading Drupal Modules - php[world] 2015
Upgrading Drupal Modules - php[world] 2015Upgrading Drupal Modules - php[world] 2015
Upgrading Drupal Modules - php[world] 2015
Chris Tankersley
 
Drupal 8 update: May 2014. Migrate in core.
Drupal 8 update: May 2014. Migrate in core.Drupal 8 update: May 2014. Migrate in core.
Drupal 8 update: May 2014. Migrate in core.
Vladimir Roudakov
 

Similar to Migrate in Drupal 8 (20)

Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7Taking your module from Drupal 6 to Drupal 7
Taking your module from Drupal 6 to Drupal 7
 
Drupal8 theming
Drupal8 themingDrupal8 theming
Drupal8 theming
 
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
 
Automating Drupal Migrations
Automating Drupal MigrationsAutomating Drupal Migrations
Automating Drupal Migrations
 
Drupal 8 migrate!
Drupal 8 migrate!Drupal 8 migrate!
Drupal 8 migrate!
 
Drupal 7 database api
Drupal 7 database api Drupal 7 database api
Drupal 7 database api
 
Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7Taking your site from Drupal 6 to Drupal 7
Taking your site from Drupal 6 to Drupal 7
 
Gestione della configurazione in Drupal 8
Gestione della configurazione in Drupal 8Gestione della configurazione in Drupal 8
Gestione della configurazione in Drupal 8
 
Debugging in drupal 8
Debugging in drupal 8Debugging in drupal 8
Debugging in drupal 8
 
Migrating to Drupal 8
Migrating to Drupal 8Migrating to Drupal 8
Migrating to Drupal 8
 
Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8
 
Drupal vs WordPress
Drupal vs WordPressDrupal vs WordPress
Drupal vs WordPress
 
Design systém 1.0
Design systém 1.0Design systém 1.0
Design systém 1.0
 
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
October 2016 - USG Rock Eagle - Everything You Need to Know to Plan Your Drup...
 
Drupal8 migrate
Drupal8 migrateDrupal8 migrate
Drupal8 migrate
 
Drupal Module Development
Drupal Module DevelopmentDrupal Module Development
Drupal Module Development
 
Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010Drupal Module Development - OSI Days 2010
Drupal Module Development - OSI Days 2010
 
Drupal @ MediaCamp Athens
Drupal @ MediaCamp Athens Drupal @ MediaCamp Athens
Drupal @ MediaCamp Athens
 
Upgrading Drupal Modules - php[world] 2015
Upgrading Drupal Modules - php[world] 2015Upgrading Drupal Modules - php[world] 2015
Upgrading Drupal Modules - php[world] 2015
 
Drupal 8 update: May 2014. Migrate in core.
Drupal 8 update: May 2014. Migrate in core.Drupal 8 update: May 2014. Migrate in core.
Drupal 8 update: May 2014. Migrate in core.
 

Recently uploaded

GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 

Recently uploaded (20)

GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 

Migrate in Drupal 8

  • 1. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Migrate in Drupal 8 Moldcamp 2015 Alexei Gorobets (asgorobets) 31.05.2015
  • 3. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis What about you?
  • 4. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Agenda.Today 01 Upgrade path overview 02 Migrate in Core, what’s there 03 Migrate API 04 Demo
  • 5.
  • 6. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Drupal upgrade. In 4 easy steps: 1. Get latest version of your current Drupal core. 2. Through next major version on top of your current 3. Run upgrade.php 4. PRAY
  • 7. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Drupal upgrade. Pros: - No coding required - Easy to run - Basic Drupal core coverage Cons: - No support for contrib modules, not even CCK - Not customizable - No way to jump versions - Clutter in database and a pleathora of bugs
  • 8. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Drupal Migrate. In 4 painful steps: 1. Develop a completely new website with same functionality from scratch 2. Create migration classes for all your entity types and bundles 3. Implement missing migrate support for contrib modules and contribute it back to the community 4. Run migrations and PRAY
  • 9. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Drupal Migrate. Pros: - Flexible and extendable Migrate API - Available solutions for contrib modules - No clutter in database, as database is new - You can jump major versions - Basic support for simplest mappings from UI Cons: - Considerable amount of coding is usually required - No way to migrate configurations - No warranties and no core and community support
  • 11. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Migrate in D8. Migrate was completely rewritten and was merged in Drupal 8 core. Migrate modules: >migrate (core) >migrate_drupal (core) >migrate_update (contrib) >migrate_plus (Migrate UI formerly - contrib)
  • 12. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Migrate in D8. Drupal to Drupal migrations allow: >Content migration with predefined mappings >Configurations migration is supported, thanks to CMI (Content Types, User profile, fields with field settings, widget settings, formatter settings) >Excellent support for i18n, both nodes and UI translations >Migration of every variable from D6 >~100 migrations defined
  • 13. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Migrate in D8. What is in Drupal core now: >Migrate API and Drupal 8 destination plugins >Drupal 6 migrate path finalized, couple of bugs left >Drupal 7 migration path started >Drupal 8 migration path planned for future releases >No interface for rollbacks, and idlist yet Not yet there:
  • 14. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Migration API. Basically Drupal’s implementation of Extract-Transform-Load (ETL) Phases: Extract > source Transform > process Load > destination
  • 15. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Plugins everywhere. Migration API works with plugins. Drupal 8 has a lot of plugins and a common plugin system. Think of it like Ctools plugins in D7 but sexier. Source plugins - extract data. From DB, YAML, JSON, whatever you need Process plugins - pipeline for data massaging. Can have unlimited number of process plugins chained Destination plugins - saves data in Drupal. Be it an entity, config or URL alias
  • 16. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Definition. Migrations are defined as config entities. id: d6_system_site label: Drupal 6 site configuration migration_groups: - Drupal 6 source: plugin: variable variables: - site_name - site_mail - site_slogan - site_frontpage - site_403 - site_404 - drupal_weight_select_max - admin_compact_mode process: name: site_name mail: site_mail slogan: site_slogan 'page/front': site_frontpage 'page/403': site_403 'page/404': site_404 weight_select_max: drupal_weight_select_max admin_compact_mode: admin_compact_mode destination: plugin: config config_name: system.site
  • 17. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Process pipeline process: format: - plugin: machine_name source: name - plugin: dedupe_entity entity_type: filter_format field: format length: 32 name: name cache: cache … filters: plugin: iterator source: filters key: @id process: id: plugin: static_map default_value: filter_null source: - module - delta map: filter: - filter_html - filter_autop - filter_url - filter_htmlcorrector - filter_html_escape php: - php_code settings: settings status: plugin: default_value default_value: true
  • 19. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis With Drush and manifest.yml File manifest.yml # nodes - d6_node - d6_node_revision - d6_node_type - d6_view_modes - d6_filter_format - d6_field_instance_per_form_display - d6_field_instance_widget_settings - d6_field_formatter_settings - d6_field_instance - d6_field - d6_field_settings - d6_node_settings … - d6_cck_field_values:* - d6_cck_field_revision:* - d6_term_node_revision - d6_term_node - d6_vocabulary_entity_display - d6_vocabulary_entity_form_display - d6_vocabulary_field_instance - d6_vocabulary_field - d6_user - d6_user_role - d6_taxonomy_vocabulary > drush migrate-manifest manifest.yml --legacy-db-url=mysql://user:password@host/dbname
  • 20. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis With Migrate Upgrade
  • 21. What if your data needs some massaging?
  • 22. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Simple massaging function hook_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) { if ($migration->id() == 'd6_filter_formats') { $value = $source->getDatabase()->query('SELECT value FROM {variable} WHERE name = :name’, array(':name' => 'mymodule_filter_foo_' . $row->getSourceProperty('format')))->fetchField(); if ($value) { $row->setSourceProperty('settings:mymodule:foo', unserialize($value)); } } }
  • 24. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Plugin definition /** * Drupal 6 menu source from database. * * @MigrateSource( * id = "d6_menu", * source_provider = "menu" * ) */ class Menu extends DrupalSqlBase { public function query() { $query = $this->select('menu_custom', 'm') ->fields('m', array('menu_name', 'title', 'description')); return $query; } public function fields() { return array( 'menu_name' => $this->t('The menu name. Primary key.'), 'title' => $this->t('The human-readable name of the menu.'), 'description' => $this->t('A description of the menu'), ); } public function getIds() { $ids['menu_name']['type'] = 'string'; return $ids; } }
  • 25. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Load plugins id: d6_cck_field_values label: Drupal 6 field values migration_groups: - Drupal 6 load: plugin: drupal_entity bundle_migration: d6_node_type source: plugin: d6_cck_field_values process: nid: plugin: migration migration: d6_node source: nid destination: plugin: entity:node migration_dependencies: required: - d6_node - d6_field_formatter_settings - d6_field_instance_widget_settings
  • 26. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Cckfield plugins/** * @PluginID("openlayers_wkt") */ class OpenlayersCckField extends CckFieldPluginBase { public function processField(MigrationInterface $migration) { // The field would be geofield rather than link if it existed. $process[0]['map'][$this->pluginId]['openlayers_wkt_widget'] = 'geofield'; $migration->mergeProcessOfProperty('type', $process); } public function processFieldWidget(MigrationInterface $migration) { // The widget would be geofield rather than link if it existed. $process['type']['map']['openlayers_wkt_widget'] = 'geofield_default'; $migration->mergeProcessOfProperty('options/type', $process); } public function getFieldFormatterMap() { return [ 'default' => 'geofield_default', 'openlayers_wkt' => 'geofield_default', 'openlayers_map_default' => 'geofield_default', 'hidden' => 'hidden', ]; } public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) { $process = [ 'plugin' => 'get', 'value' => 'openlayers_wkt', ]; $migration->mergeProcessOfProperty($field_name, $process); } }
  • 28. Formerly known as Bysted, Propeople, Blink Reaction, Chainbizz and Geekpolis Further study https://www.drupal.org/project/examples https://www.drupal.org/developing/api/8 https://api.drupal.org/api/drupal/8 https://www.drupal.org/list-changes https://drupalize.me/blog/201409/unravelling-drupal-8-plugin-system https://drupalize.me/blog/201408/preparing-drupal-8-psr-4-autoloading https://www.drupal.org/documentation/administer/config
  • 29. … and happy migrations! Thank you