Migrating properties which are set through Control Panel to portal-ext.properties file

Important Notification: Modifying the database is a risky operation! Always make a backup of your database before any modifications!

If your custom portal properties are already set through the Control Panel then Liferay will not use the properties which are set up in portal-ext.properties file. This happens because when you set a property in the Control Panel, it is stored in the database and the values in the database override the settings in portal-ext.properties.

Unfortunately, when you set a value in the control panel, Liferay must use the control panel to control that property from that point on. This is because even if you remove the property in the Control Panel, the database will have an empty value on that property. Even these empty values still have precedence over the values in portal-ext.properties.

In order to use portal-ext.properties once again you have to delete the appropriate preferences from the database. In the database these properties are stored in the table called "portalpreferences" in the "preferences" column in a specific field and they look like this:

open.sso.logout.urlhttp://CUSTOM_ATTR.example.com:8080/opensso/UI/Logout?goto=http://portalhost.example.com:8080/web/guest/home


As previously mentioned, an empty value looks like this:

open.sso.logout.url

Resolution

To use portal-ext.properties file's attributes once again follow these steps:

  1. Use a GUI database tool like MySQL Workbench

  2. Go to the database of the portal and find the table called "portalpreferences."

  3. Run a query which contains the name of the attribute you are looking for. In our case we would like to change the previously mentioned open.sso.logout.url setting and we would like to check other oppen.sso related settings so the query in this case is:

    SELECT * FROM [database-name].portalpreferences where PREFERENCES like '%open.sso%';

    In the example below, when right clicking the Columns in the table it automatically inserts the query:

    SELECT * FROM [database-name].portalpreferences;

  4. Copy all the field data to a text editor and carefully delete the previously mentioned preference:
    open.sso.logout.urlhttp://CUSTOM_ATTR.example.com:8080/opensso/UI/Logout?goto=http://portalhost.example.com:8080/web/guest/home

  5. When finished save the new field value back to the database. MySQL Workbench will automatically create the query for you to alter the table. Don't forget to commit the changes. (Notice the Apply button on the lower right corner)

  6. The specific value is now cleared, you can set it up in portal-ext.properties.

Please note that there are properties which are needed to start the portal properly so make sure you have already set up the properties in portal-ext.properties file before starting up Liferay after clearing them from the database.

Additional Information

Tips:

  1. You can find the attribute names in portal.properties file, they should be similar in the database. In our example you can find open.sso.logout.url both in portal.properties and in the database.
  2. You can also find your values by setting them to a special name.
  3. Default attributes: If there is no property neither in portal-ext.properties nor in Control Panel there might be default value already set up. These values are coming from the portal source and the portal automatically populates the values in Control Panel. These can be overwritten in either the control panel or the portal-ext.properties.
这篇文章有帮助吗?
0 人中有 0 人觉得有帮助