How Liferay portal upgrades the content?


  • The portlet id('s) which has included in the content of the web content portlet is not getting updated after upgrading the portal.


  • Liferay portal 6.2EE
  • Liferay DXP 7.0


How Liferay works?

  • Liferay will be upgraded the entire portal[Eg: 6.2] based on the source code of the Liferay version you are upgrading to [Eg: DXP].
  • Wherein if you are providing static content, Liferay will not read the entire static content to be parsed based on the Liferay destination version.
    • For example:
      • If the portlet id were included as static content
        • Liferay will not modify the portlet id [static content] as per the naming standard of the destination version of the Liferay when upgrading the portal
        • This is the intended behavior of the Liferay.

Example use case:

  • Detailed steps help to understand the behavior in a better way. The below use case is to demonstrate the behavior.

  • Case 1:  Add custom CSS using the portlet configuration functionality

1. Install the Liferay 6.2 uncustomized instance and start the server.
2. For testing purpose, add some web content portlets at least one or two WC's on the page. [In this case, WC1, WC2]
3. From one of the web content portlet like WC1, navigate to the look and feel configuration by clicking on the three ellipsis dot on the portlet topper.
4. Click on the Advanced Styling tab
5. Under the section "Enter your custom CSS." [For testing purpose only]. In this case, the below code placed based on the WC1, WC2 portlet id

#portlet_56_INSTANCE_Y3IiwK51r0YH .portlet-content {    
  background-color: linen;   
#portlet_56_INSTANCE_ne92rVoKKAmV .portlet-content
background-color: cyan;   
Portlet ID: #portlet_56_INSTANCE_Y3IiwK51r0YH
Portlet Classes: .portlet-journal-content
Portlet instance id number: 56


6. Save it.

Test Result:

In Liferay 6.2, Applied style reflected on the portlets. 


7. Upgraded to Liferay DXP 7.0

Observed behavior: [Issue replicated]

CSS style gets broken in Liferay DXP and applied styles of Liferay 6.2 not reflected here.

The reason behind this,

    • The portlets id and class name have changed as per the naming conventions of the fully qualified portlet in DXP
    • The advance styling option allows you to enter CSS code to customize the look and feel of your portlet. While upgrading, Liferay does not upgrade the custom code. 
    • Liferay 6.2: Portlet ID: #portlet_56_INSTANCE_Y3IiwK51r0YH
      Portlet Classes: .portlet-journal-content
    • Liferay DXP: Portlet ID: #portlet_com_liferay_journal_content_web_portlet_JournalContentPortlet_INSTANCE_Y3IiwK51r0YH
      Portlet Classes: .portlet-decorate.portlet-journal-content .portlet-content.portlet-content-editable
  • Note: Please check Liferay-portlet.xml for the portlet ID in Liferay 6.2 and replace it with the updated ID as per the destination version of the Liferay.

Additional Information

0 人中有 0 人觉得有帮助