Liferay Migration

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Prepare for migration

We need to clear data from old versions, duplicates and other unnecessary files.
Download Liferay 7.1 CE at this step

Remove unused objects


We need to remove unused objects (Layouts, Users, Documents, etc.). Liferay procreates
intermediate versions of web contents and documents every time the content is edited.

Remove duplicated structure names


If you have different web content structures (text, images, links, checkboxes, etc.) in your
portal, they are likely to have fields with the same names. It’s OK for Liferay 6.2, but
migration to 7.x will fail because Liferay DMX requires having unique names of fields.
Therefore, we need to rename structure fields, so they are unique overall the portal.

Liferay 7.1 installation/configuration


Install liferay 7.1.

PREPARE DATABASE FOR MIGRATION

1. Create a separate database for migration in MySQL:

create database lr_migration_dxp character set utf8

1. Create a database dump from 6.2 database and load it to new one:

mysqldump -uroot -p1 lr_migration > lr_migration.sql


mysql -uroot -p1 lr_migration_dxp < lr_migration.sql

1. Specify database connection properties

Create file ‘portal-setup-wizard.properties’ with the DB connection properties inside:


jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost:3306/lr_migration_dxp
jdbc.default.username=root
jdbc.default.password=1

DON’T START LIFERAY INSTANCE TILL THIS STEP.


Copy data
To transfer document library files to the new environment, copy document_library and image
folders into the data folder from Liferay 6.2 to Liferay 7.1. The migrated data will be stored in
the default store. A location you can choose up to you.

Disable indexer and autoUpgrade


Add file com.liferay.portal.search.configuration.IndexStatusManagerConfiguration.config to
my folder [Liferay Home]/osgi/configs with the following content:
indexReadOnly=”true”
Add
file com.liferay.portal.upgrade.internal.configuration.ReleaseManagerConfiguration.config to
the same folder [Liferay Home]/osgi/configs with autoUpgrade=”false” content.
Configure the upgrade tool
Unlike previous Liferay versions, where we had just to specify database configuration
properties, and Liferay performed upgrade process during the startup, Liferay 7.x comes with
a dedicated tool for database upgrade ‘portal-tools-db-upgrade-client’ in LR/tools folder.
We need to configure the following files before running the upgrade:
App-server.properties
Portal-upgrade-database.properties
Portal-upgrade-ext.properties
We should check a release buildNumber before running the upgrade tool because it is
incremented by Liferay after each deployment in Service Builder which is used for
generating internal database persistence code.
It should be 62xx before you run the upgrade.
Running the upgrade tool
Here we invoke the upgrade tool with the script ./db_upgrade.sh -l for Linux
and “db_upgrade.log” for Windows. This will update Liferay core and output message
“Completed liferay core upgrage and verify..”
Enabling indexer
indexReadOnly=”false”

Liferay theme migration


Before starting theme migration, we should consider the main points which were changed in
Liferay 7.1:

 Velocity templates are no longer supported in favor of FreeMarker;


 Dockbar has been replaced with different menus: Product Menu, Control Menu, User
Personal Bar.

Ways to update theme:


yo liferay-theme:import Note: this way works only for themes, created with Ant-base Liferay
plugin SDK. Otherwise, such exception will appear:

1. Run Gulp upgrade task to upgrade the theme:

yo liferay-theme:import
Liferay portlet migration
To migrate portlet code, use the Code Upgrade Tool in Liferay Developer Studio (Project ->
Liferay Code Upgrade Tool menu). After importing project we can click “Find breaking
changes” button, and a list of code problems will appear:
Each of them contains API changes explanation, which affects custom code, reasons for it,
links to Liferay JIRA tickets, examples and recommendations to fix code issues. Some of
code problems can be fixed automatically using Liferay IDE, other ones need manual actions.
After fixing all the issues, you can try to build the portlet for Liferay 7.1. If you work in IntelliJ
IDEA, you can copy migrated code to it from Liferay IDE.
Liferay hook migration
For hook migration (especially for JSP hooks) it’s better to create a hook module from scratch
and overwrite the required JSP page. As Liferay’s JSP pages have changed significantly from
Liferay 6.x to 7.x, using old 6.2 JSP pages for new 7.1 Liferay may break some functionality.
So, you need to create a hook module, find appropriate JSP, and overwrite it in hook, copying
changes from 6.2.
Then just apply these changes to your Liferay 7.1 page and deploy the hook.
Liferay layout migration
For layout migration we can create a new layout with Liferay IntelliJ plugin:
After that we can adjust FTL template according to the 6.2 code

You might also like