SlideShare a Scribd company logo
1 of 32
Мигрируем на Drupal 8! 
#dckiev14
About us 
Andy Postnikov http://dgo.to/@andypost 
Pavel Makhrinsky http://dgo.to/@gumanist
More then 2% of all sites 
How many sites are running Drupal 6 and 7?
Latest stats
10 Drupal myths 
● Box product 
● Lego 
● Contrib - themes, modules, libraries 
● Multilingual 
● Platform 
● Support 
● Community 
● Evolution
Go Drupal 8 
● PHP 5.4 - 5.5, 5.6.2 
● HTML 5 
● Libraries - jQuery 2.1 (3.0) 
● Modules 
● CDN - REST 
● Database
Common migration tasks 
● Planning 
o Data mapping 
o Dependencies management 
o Data cleanup 
● Chicken 'n Egg handling 
● Continuous content lifecycle 
● Progress monitoring 
● Rollback results
What is the migrate module? 
Source => Process => Destination
Migrate vs Feeds 
Mostly indentical feature set: 
● Since 2009 but FeedAPI 2007 
● feeds is UI-oriented 
● feeds_tamper vs custom code 
● feeds has a lot of satelite modules
Migrate in Drupal 8 retrospective 
Signed after 6 weeks away from feature freeze 
https://www.drupal.org/node/1052692#comment-6620570 
Initial patch was commited November 21, 2013 
https://www.drupal.org/node/2125717#comment-8197259 
Drupal 6 to Drupal 8 patch April 23, 2014 
https://www.drupal.org/node/2121299#comment-8710315 
Still in progress of polishing 
https://groups.drupal.org/imp - weekly call
Processing
Mapping
Definition (yml-file) 
id: migrate_example_people 
source: 
plugin: migrate_example_people 
destination: 
plugin: entity:user 
md5_passwords: true 
process: 
name: 
- 
plugin: concat 
delimiter: . 
source: 
- first_name 
- last_name 
- 
plugin: callback 
callable: 
- 'DrupalComponentUtilityUnicode' 
- strtolower 
- 
plugin: callback 
callable: trim 
- 
plugin: dedupe_entity 
entity_type: user 
field: name 
mail: email 
pass: pass 
roles: 
- 
plugin: explode 
delimiter: ';' 
source: groups
Chicken and egg 
process: 
tid: tid 
vid: 
plugin: migration 
migration: d6_taxonomy_vocabulary 
source: vid 
parent: 
- 
plugin: skip_process_on_empty 
source: parent 
- 
plugin: migration 
migration: d6_taxonomy_term
Dependencies 
migration_dependencies: 
required: 
- d6_filter_format 
- d6_user_role 
- d6_user_picture_entity_display 
- d6_user_picture_entity_form_display 
optional: 
- d6_user_picture_file
Execution flow 
class MigrateExecutable { 
/** Performs an import operation - migrate items from source to destination. */ 
public function import() { 
$source = $this->getSource(); 
$id_map = $this->migration->getIdMap(); 
$source->rewind(); 
while ($source->valid()) { 
$row = $source->current(); 
$this->processRow($row); 
$destination_id_values = $destination->import($row, $id_map- 
>lookupDestinationId($this->sourceIdValues)); 
$id_map->saveIdMapping($row, $destination_id_values, $this- 
>sourceRowStatus, $this->rollbackAction); 
$source->next(); 
} 
}
Source plugins 
Provides source rows - mostly custom 
1. getIterator(): iterator producing rows 
2. prepareRow(): add more data to a row 
3. There are hooks for prepareRow() 
MigrateSourceInterface
Source example - core 
/** 
* Drupal 6 menu source from database. 
* 
* @MigrateSource( 
* id = "d6_menu", 
* source_provider = "menu" 
* ) 
*/ 
class Menu extends DrupalSqlBase { 
/** 
* {@inheritdoc} 
*/ 
public function query() { 
$query = $this->select('menu_custom', 'm') 
->fields('m', array('menu_name', 'title', 'description')); 
return $query; 
}
Source example - custom 
public function count() { 
if (is_array($this->getData())) { 
return count($this->getData()); 
} 
return 0; 
} 
public function getIterator() { 
return new ArrayIterator($this->getData()); 
} 
protected function getData() { 
if (!isset($this->data)) { 
$this->data = array(); 
foreach ($this->fetchDataFromYandexDirect() as $key => $value) { 
$this->data[$key] = (array) $value; 
} 
} 
return $this->data; 
}
Process plugins 
● Keys are destination properties 
● Values are process pipelines 
● Each pipeline is a series of process plugins 
+ configuration 
● There are shorthands 
MigrateProcessInterface::transform()
Process pipelines 
process: 
id: 
- 
plugin: machine_name 
source: name 
- 
plugin: dedupe_entity 
entity_type: user_role 
field: id 
- 
plugin: user_update_8002 #custom
Process plugins shipped 
Constant values 
Plugins: 
 get 
 concat 
 dedupebase 
 iterator 
 skip_row_if_not_set 
 default_value 
 extract 
 flatten 
 iterator 
 migration 
 skip_process_on_empty 
 skip_row_on_empty 
 static map 
 machine_name 
 dedupe_entity 
 callback
Process plugin example 
public function transform($value, MigrateExecutable 
$migrate_executable, Row $row, $destination_property) { 
$new_value = $this->getTransliteration()- 
>transliterate($value, 
LanguageInterface::LANGCODE_DEFAULT, '_'); 
$new_value = strtolower($new_value); 
$new_value = preg_replace('/[^a-z0-9_]+/', '_', 
$new_value); 
return preg_replace('/_+/', '_', $new_value); 
}
Destination plugins 
● Does the actual import 
● Almost always provided by migrate module 
● Most common is entity:$entity_type 
o entity:node 
o entity:user 
● If you are writing one, you are doing it wrong 
MigrateDestinationInterface
Destination plugins shipped 
● Config 
● Entity 
● Null 
● for custom tables: url_alias, user_data… 
destination: 
plugin: config 
config_name: user.mail
Destination plugin example 
/** 
* {@inheritdoc} 
*/ 
public function import(Row $row, array $old_destination_id_values = 
array()) { 
$path = $this->aliasStorage->save( 
$row->getDestinationProperty('source'), 
$row->getDestinationProperty('alias'), 
$row->getDestinationProperty('langcode'), 
$old_destination_id_values ? $old_destination_id_values[0] : NULL 
); 
return array($path['pid']); 
}
Demo 
● Drush 
● UI sandbox
Drush or custom code 
Recommended way to execute - DRUSH 
Custom code: 
public function submitForm(array &$form, array &$form_state) { 
/** @var $migration DrupalmigrateEntityMigrationInterface */ 
$migration = entity_load('migration', $form_state['values']['migration']); 
$executable = new MigrateExecutable($migration, $this); 
$executable->import(); 
// Display statistics. 
$this->getStats($form, $form_state); 
$form_state['rebuild'] = TRUE; 
}
How to help 
Document driven development 
http://dgo.to/2127611 
Open issues of migration system: 
http://goo.gl/fmVNQl 
Drupal groups http://dgo.to/g/imp 
IRC: Freenode #drupal-migrate
Links 
https://www.drupal.org/upgrade/migrate 
https://www.drupal.org/node/2127611 
https://groups.drupal.org/imp 
IRC: Freenode #drupal-migrate
Questions & Discussions 
Andy Postnikov http://dgo.to/@andypost 
Pavel Makhrinsky http://dgo.to/@gumanist 
Kiev 2014
Roadmap d8 
● миграция только посредством migrate 
● текущее состояние (d6->d8, d7 testing) 
● drush demo! UI contrib 
● под капотом 
o как работает, сходство с 7 
o состоит - сущности и плагины 
o кастомные - source, destination, plugins 
o stubs, parent migrations 
● needs work 
o d7 test, demo?! 
o migration groups, ui

More Related Content

What's hot

Php unit the-mostunknownparts
Php unit the-mostunknownpartsPhp unit the-mostunknownparts
Php unit the-mostunknownpartsBastian Feder
 
Doctrine fixtures
Doctrine fixturesDoctrine fixtures
Doctrine fixturesBill Chang
 
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Leonardo Proietti
 
PHP Data Objects
PHP Data ObjectsPHP Data Objects
PHP Data ObjectsWez Furlong
 
Modularity and Layered Data Model
Modularity and Layered Data ModelModularity and Layered Data Model
Modularity and Layered Data ModelAttila Jenei
 
The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09Bastian Feder
 
The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016Kacper Gunia
 
The Origin of Lithium
The Origin of LithiumThe Origin of Lithium
The Origin of LithiumNate Abele
 
Symfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il clienteSymfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il clienteLeonardo Proietti
 
Drupal 8: Entities
Drupal 8: EntitiesDrupal 8: Entities
Drupal 8: Entitiesdrubb
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium AppsNate Abele
 
Drupal 8: Forms
Drupal 8: FormsDrupal 8: Forms
Drupal 8: Formsdrubb
 
Design Patterns in PHP5
Design Patterns in PHP5 Design Patterns in PHP5
Design Patterns in PHP5 Wildan Maulana
 
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionLithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionNate Abele
 
What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?Alexandru Badiu
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2Hugo Hamon
 
Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!Kacper Gunia
 

What's hot (20)

Php unit the-mostunknownparts
Php unit the-mostunknownpartsPhp unit the-mostunknownparts
Php unit the-mostunknownparts
 
Doctrine fixtures
Doctrine fixturesDoctrine fixtures
Doctrine fixtures
 
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5
 
PHP Data Objects
PHP Data ObjectsPHP Data Objects
PHP Data Objects
 
Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3
 
Modularity and Layered Data Model
Modularity and Layered Data ModelModularity and Layered Data Model
Modularity and Layered Data Model
 
The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09
 
Lithium Best
Lithium Best Lithium Best
Lithium Best
 
The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016
 
The Origin of Lithium
The Origin of LithiumThe Origin of Lithium
The Origin of Lithium
 
Symfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il clienteSymfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il cliente
 
Drupal 8: Entities
Drupal 8: EntitiesDrupal 8: Entities
Drupal 8: Entities
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium Apps
 
Drupal 8: Forms
Drupal 8: FormsDrupal 8: Forms
Drupal 8: Forms
 
Design Patterns in PHP5
Design Patterns in PHP5 Design Patterns in PHP5
Design Patterns in PHP5
 
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo EditionLithium: The Framework for People Who Hate Frameworks, Tokyo Edition
Lithium: The Framework for People Who Hate Frameworks, Tokyo Edition
 
What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?
 
Quebec pdo
Quebec pdoQuebec pdo
Quebec pdo
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2
 
Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!
 

Similar to Drupal 8 migrate!

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
 
Php on the desktop and php gtk2
Php on the desktop and php gtk2Php on the desktop and php gtk2
Php on the desktop and php gtk2Elizabeth Smith
 
Laravel5 Introduction and essentials
Laravel5 Introduction and essentialsLaravel5 Introduction and essentials
Laravel5 Introduction and essentialsPramod Kadam
 
Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)Jonathan Felch
 
Debugging in drupal 8
Debugging in drupal 8Debugging in drupal 8
Debugging in drupal 8Allie Jones
 
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptjQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptDarren Mothersele
 
Zend Framework 2 - Basic Components
Zend Framework 2  - Basic ComponentsZend Framework 2  - Basic Components
Zend Framework 2 - Basic ComponentsMateusz Tymek
 
Automating Drupal Migrations
Automating Drupal MigrationsAutomating Drupal Migrations
Automating Drupal MigrationslittleMAS
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Shinya Ohyanagi
 
Как получить чёрный пояс по WordPress?
Как получить чёрный пояс по WordPress?Как получить чёрный пояс по WordPress?
Как получить чёрный пояс по WordPress?Yevhen Kotelnytskyi
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionPhilip Norton
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenchesLukas Smith
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ EtsyNishan Subedi
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For BeginnersJonathan Wage
 
Magento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowMagento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowVrann Tulika
 
Opencast Admin UI - Introduction to developing using AngularJS
Opencast Admin UI - Introduction to developing using AngularJSOpencast Admin UI - Introduction to developing using AngularJS
Opencast Admin UI - Introduction to developing using AngularJSbuttyx
 

Similar to Drupal 8 migrate! (20)

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
 
Drupal 7 database api
Drupal 7 database api Drupal 7 database api
Drupal 7 database api
 
Php on the desktop and php gtk2
Php on the desktop and php gtk2Php on the desktop and php gtk2
Php on the desktop and php gtk2
 
Laravel5 Introduction and essentials
Laravel5 Introduction and essentialsLaravel5 Introduction and essentials
Laravel5 Introduction and essentials
 
Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)
 
Debugging in drupal 8
Debugging in drupal 8Debugging in drupal 8
Debugging in drupal 8
 
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptjQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
 
Zend Framework 2 - Basic Components
Zend Framework 2  - Basic ComponentsZend Framework 2  - Basic Components
Zend Framework 2 - Basic Components
 
Automating Drupal Migrations
Automating Drupal MigrationsAutomating Drupal Migrations
Automating Drupal Migrations
 
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
 
Как получить чёрный пояс по WordPress?
Как получить чёрный пояс по WordPress?Как получить чёрный пояс по WordPress?
Как получить чёрный пояс по WordPress?
 
Fatc
FatcFatc
Fatc
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency Injection
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenches
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
Magento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request FlowMagento Live Australia 2016: Request Flow
Magento Live Australia 2016: Request Flow
 
Opencast Admin UI - Introduction to developing using AngularJS
Opencast Admin UI - Introduction to developing using AngularJSOpencast Admin UI - Introduction to developing using AngularJS
Opencast Admin UI - Introduction to developing using AngularJS
 

Recently uploaded

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 

Recently uploaded (20)

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 

Drupal 8 migrate!

  • 2. About us Andy Postnikov http://dgo.to/@andypost Pavel Makhrinsky http://dgo.to/@gumanist
  • 3. More then 2% of all sites How many sites are running Drupal 6 and 7?
  • 5. 10 Drupal myths ● Box product ● Lego ● Contrib - themes, modules, libraries ● Multilingual ● Platform ● Support ● Community ● Evolution
  • 6. Go Drupal 8 ● PHP 5.4 - 5.5, 5.6.2 ● HTML 5 ● Libraries - jQuery 2.1 (3.0) ● Modules ● CDN - REST ● Database
  • 7. Common migration tasks ● Planning o Data mapping o Dependencies management o Data cleanup ● Chicken 'n Egg handling ● Continuous content lifecycle ● Progress monitoring ● Rollback results
  • 8. What is the migrate module? Source => Process => Destination
  • 9. Migrate vs Feeds Mostly indentical feature set: ● Since 2009 but FeedAPI 2007 ● feeds is UI-oriented ● feeds_tamper vs custom code ● feeds has a lot of satelite modules
  • 10. Migrate in Drupal 8 retrospective Signed after 6 weeks away from feature freeze https://www.drupal.org/node/1052692#comment-6620570 Initial patch was commited November 21, 2013 https://www.drupal.org/node/2125717#comment-8197259 Drupal 6 to Drupal 8 patch April 23, 2014 https://www.drupal.org/node/2121299#comment-8710315 Still in progress of polishing https://groups.drupal.org/imp - weekly call
  • 13. Definition (yml-file) id: migrate_example_people source: plugin: migrate_example_people destination: plugin: entity:user md5_passwords: true process: name: - plugin: concat delimiter: . source: - first_name - last_name - plugin: callback callable: - 'DrupalComponentUtilityUnicode' - strtolower - plugin: callback callable: trim - plugin: dedupe_entity entity_type: user field: name mail: email pass: pass roles: - plugin: explode delimiter: ';' source: groups
  • 14. Chicken and egg process: tid: tid vid: plugin: migration migration: d6_taxonomy_vocabulary source: vid parent: - plugin: skip_process_on_empty source: parent - plugin: migration migration: d6_taxonomy_term
  • 15. Dependencies migration_dependencies: required: - d6_filter_format - d6_user_role - d6_user_picture_entity_display - d6_user_picture_entity_form_display optional: - d6_user_picture_file
  • 16. Execution flow class MigrateExecutable { /** Performs an import operation - migrate items from source to destination. */ public function import() { $source = $this->getSource(); $id_map = $this->migration->getIdMap(); $source->rewind(); while ($source->valid()) { $row = $source->current(); $this->processRow($row); $destination_id_values = $destination->import($row, $id_map- >lookupDestinationId($this->sourceIdValues)); $id_map->saveIdMapping($row, $destination_id_values, $this- >sourceRowStatus, $this->rollbackAction); $source->next(); } }
  • 17. Source plugins Provides source rows - mostly custom 1. getIterator(): iterator producing rows 2. prepareRow(): add more data to a row 3. There are hooks for prepareRow() MigrateSourceInterface
  • 18. Source example - core /** * Drupal 6 menu source from database. * * @MigrateSource( * id = "d6_menu", * source_provider = "menu" * ) */ class Menu extends DrupalSqlBase { /** * {@inheritdoc} */ public function query() { $query = $this->select('menu_custom', 'm') ->fields('m', array('menu_name', 'title', 'description')); return $query; }
  • 19. Source example - custom public function count() { if (is_array($this->getData())) { return count($this->getData()); } return 0; } public function getIterator() { return new ArrayIterator($this->getData()); } protected function getData() { if (!isset($this->data)) { $this->data = array(); foreach ($this->fetchDataFromYandexDirect() as $key => $value) { $this->data[$key] = (array) $value; } } return $this->data; }
  • 20. Process plugins ● Keys are destination properties ● Values are process pipelines ● Each pipeline is a series of process plugins + configuration ● There are shorthands MigrateProcessInterface::transform()
  • 21. Process pipelines process: id: - plugin: machine_name source: name - plugin: dedupe_entity entity_type: user_role field: id - plugin: user_update_8002 #custom
  • 22. Process plugins shipped Constant values Plugins:  get  concat  dedupebase  iterator  skip_row_if_not_set  default_value  extract  flatten  iterator  migration  skip_process_on_empty  skip_row_on_empty  static map  machine_name  dedupe_entity  callback
  • 23. Process plugin example public function transform($value, MigrateExecutable $migrate_executable, Row $row, $destination_property) { $new_value = $this->getTransliteration()- >transliterate($value, LanguageInterface::LANGCODE_DEFAULT, '_'); $new_value = strtolower($new_value); $new_value = preg_replace('/[^a-z0-9_]+/', '_', $new_value); return preg_replace('/_+/', '_', $new_value); }
  • 24. Destination plugins ● Does the actual import ● Almost always provided by migrate module ● Most common is entity:$entity_type o entity:node o entity:user ● If you are writing one, you are doing it wrong MigrateDestinationInterface
  • 25. Destination plugins shipped ● Config ● Entity ● Null ● for custom tables: url_alias, user_data… destination: plugin: config config_name: user.mail
  • 26. Destination plugin example /** * {@inheritdoc} */ public function import(Row $row, array $old_destination_id_values = array()) { $path = $this->aliasStorage->save( $row->getDestinationProperty('source'), $row->getDestinationProperty('alias'), $row->getDestinationProperty('langcode'), $old_destination_id_values ? $old_destination_id_values[0] : NULL ); return array($path['pid']); }
  • 27. Demo ● Drush ● UI sandbox
  • 28. Drush or custom code Recommended way to execute - DRUSH Custom code: public function submitForm(array &$form, array &$form_state) { /** @var $migration DrupalmigrateEntityMigrationInterface */ $migration = entity_load('migration', $form_state['values']['migration']); $executable = new MigrateExecutable($migration, $this); $executable->import(); // Display statistics. $this->getStats($form, $form_state); $form_state['rebuild'] = TRUE; }
  • 29. How to help Document driven development http://dgo.to/2127611 Open issues of migration system: http://goo.gl/fmVNQl Drupal groups http://dgo.to/g/imp IRC: Freenode #drupal-migrate
  • 30. Links https://www.drupal.org/upgrade/migrate https://www.drupal.org/node/2127611 https://groups.drupal.org/imp IRC: Freenode #drupal-migrate
  • 31. Questions & Discussions Andy Postnikov http://dgo.to/@andypost Pavel Makhrinsky http://dgo.to/@gumanist Kiev 2014
  • 32. Roadmap d8 ● миграция только посредством migrate ● текущее состояние (d6->d8, d7 testing) ● drush demo! UI contrib ● под капотом o как работает, сходство с 7 o состоит - сущности и плагины o кастомные - source, destination, plugins o stubs, parent migrations ● needs work o d7 test, demo?! o migration groups, ui

Editor's Notes

  1. Текущее состояние модуля migrate и migrate_drupal в ядре Покажем миграцию с drupal 6 на 8 Расскажем, что находится “под капотом” Обсудим грядущие и возможные изменения
  2. Наукоград имени Dries B
  3. 1/5
  4. 5 - Что из себя представляет миграция данных вообще как общая задача
  5. Начальная идея была использовать только конфигурации для д2д
  6. 2 - кратко рассказать, что различия в основном архитектурные, feeds орентирован на UI, больше процессинга
  7. 5 - решение принято после фризов, так как важный таск. раньше была возможность мигрировать сайт, но не было возможности расширяться.
  8. Начальная идея была использовать только конфигурации для д2д
  9. 5 - описание потока выполнения
  10. Описание интерфейса, рассказать, что можно забирать данные например из web service
  11. добавить пример базы, JSON, prepareRow()
  12. Описание интерфейса, рассказать, что можно забирать данные например из web service
  13. Описание интерфейса, рассказать, что можно забирать данные например из web service
  14. Описание интерфейса, рассказать, что можно забирать данные например из web service
  15. needs link to d,o handbook
  16. 5 - запустить пример миграции