Upload
meet-magento-italy
View
4.443
Download
4
Embed Size (px)
Citation preview
Magento 2 Upgrade Scope
Database
Schema
Data
Codebase
Magento framework
3rd party extensions
Custom modules
Custom themes
@SergiiShymko #mm16it
Magento 2 Upgrade Tooling
Database
Schema
Data
Codebase
Magento framework
3rd party extensions
Custom modules
Custom themes
Data migration toolgithub.com/magento/data-migration-tool
Code migration toolgithub.com/magento/code-migration
@SergiiShymko #mm16it
Code Migration Tool Scope
Directorystructure
Configuration
<?php // code ;)
Layout
Magentomodule
@SergiiShymko #mm16it
Code Migration Tool Overview
• Audience: Magento developers
• Interface: Command line interface (CLI)
• Goal: Automate routine code changes
• Methodology: Static code analysis
Code migration tool
@SergiiShymko #mm16it
Magento 1.xsource code
Magento 2source code
Prerequisite Directory Structure
@SergiiShymko #mm16it
<tool> – Installed M2 code migration tool
<src> – Custom M1 code to be migrated
<dst> – Empty directory to put generated M2 code to
<m1> – Vanilla M1 codebase + Custom M1 code (<src>)
<m2> – Vanilla M2 codebase
Directories Utilization
Code migration tool
@SergiiShymko #mm16it
<src> <dst>
<m1> <m2>
Directories Utilization
Code migration tool
@SergiiShymko #mm16it
<src> <dst>
<m1> <m2>
Migration Sequence
Generate mappings
Migrate directory structure
Migrate layout
Migrate config
Migrate PHP code
1. 2. 3. 4. 5.
@SergiiShymko #mm16it
Command to run:
1. Mapping Generation
• Mapping between:
– Latest M1 and M2 releases – out of the box
– Any M1 and M2 versions – generated on demand
• Mapping covers:
– Module names
– Class names & dependencies
– Table names
– View files
@SergiiShymko #mm16it
php <tool>/bin/utils.php generateClassMapping <m1> <m2>
Command to run:
2. Directory Structure Migration
• Removal of code pools (core, community, local)
• Aggregation of module’s files in a single directory:
– PHP code
– Templates
– Layouts
– Static assets
– Translation dictionaries
@SergiiShymko #mm16it
php <tool>/bin/migrate.php migrateModuleStructure <src> <dst>
Magento 1.x Magento 2
app/code/
community/Example/Module/
etc/modules/locale/<locale>/design/
<area>/base/default/skin/
<area>/base/default/
app/
code/
Example/Module/
etc/
i18n/<locale>/
view/<area>/
2. Directory Structure Migration
@SergiiShymko #mm16it
Command to run:
3. Layout Migration
• Breaking down layout files by handles
• Format of layout XML files:
– Block types
– Block names
– Template references
– References to blocks and containers
– Adding JS/CSS assets to page head
@SergiiShymko #mm16it
php <tool>/bin/migrate.php convertLayout <dst>
Magento 1.x Magento 2
app/
design/
frontend/
base/default/
layout/
example.xml
app/
code/
Example/Module/
view/
frontend/
layout/
default.xml
…
3. Layout Migration
@SergiiShymko #mm16it
Command to run:
4. Configuration Migration
• Breaking down config.xml into granular configs
• Format of config XML files:
– Module declaration
– Routers
– Indexers
– Admin menu
– System configuration
– Widgets
@SergiiShymko #mm16it
php <tool>/bin/migrate.php convertConfig <dst>
Magento 1.x Magento 2
app/
code/community/
Example/Module/
etc/
config.xml
app/
code/
Example/Module/
etc/[<area>/]
module.xml
…
4. Configuration Migration
…
@SergiiShymko #mm16it
Command to run:
5. PHP Code Migration
• Breaking down controllers by actions
• Format of PHP files:
– Class namespaces
– Dependency injection via constructor
– Class name aliases in factory methods
– Class names in static calls, constants, arguments, operator “new”, PHPDoc
– Table name aliases
– Translation via “gettext”
@SergiiShymko #mm16it
php <tool>/bin/migrate.php convertPhpCode <dst> <m1> <m2>
5. PHP Code Migration
@SergiiShymko #mm16it
Tool Commands Summary
1. Generate mappings
2. Migrate directory structure
3. Migrate layout
4. Migrate configuration
5. Migrate PHP code
php <tool>/bin/migrate.php migrateModuleStructure <src> <dst>
php <tool>/bin/migrate.php convertLayout <dst>
php <tool>/bin/migrate.php convertConfig <dst>
php <tool>/bin/migrate.php convertPhpCode <dst> <m1> <m2>
php <tool>/bin/utils.php generateClassMapping <m1> <m2>
@SergiiShymko #mm16it
a. Commit disabled M2 modulesb. Test, fix, and enable module by module
3. M2 codebase tasks
Upgrade Project Breakdown
2. Code migration tool tasks
a. Tailor the tool for patterns unique to the projectb. Run the tool against M1 codebase
1. M1 codebase tasks
a. Remove unused modulesb. Remove fixes of M1 bugs irrelevant in M2
@SergiiShymko #mm16it
Sergii [email protected]
github.com/magento/code-migration
github.com/magento/data-migration-tool
devdocs.magento.com/guides/v2.0/migration/migration-tool.html
Thank You!
Q & A