Before installing any patches, you must shut down your server. On Windows operating systems, files in use are locked by the OS, and can’t be patched. On Unix-style systems, you can usually replace files that are running, but the old ones reside in memory. For these reasons, it is best to shut down Liferay DXP before installing patches.
Liferay distributes all patches (fix packs and hotfixes) as ZIP files. When you
download a patch, either from a
Help Center
ticket (hotfix) or from the
Customer Portal
(fix pack), place it in the Patching Tool’s patches
folder (e.g., [Liferay Home]/patching-tool/patches
) without unzipping it. To list your installed
patches and available local patches, execute this command:
patching-tool info
This displays a list of patches you’ve already installed, along with a list of
patches that can be installed from what’s in the patches
folder.
To install the available patches, use the following steps. First, issue the following command:
patching-tool install
To make sure the all changed OSGi bundles replace the existing ones, delete the
osgi/state
folder from the
Liferay Home folder.
If there are new database indexes created by the patch, the Patching Tool tells you to update them. To get the list, run this command:
patching-tool index-info
Since there’s no database connection at patching time, the indexes must be
created at portal startup. If the server has permissions to modify the database
indexes, instruct Liferay DXP to create the indexes automatically at startup by
adding this setting to your portal-ext.properties
file:
database.indexes.update.on.startup=true
Otherwise, you must create the indexes manually. Check the
patching-tool index-info
command output for more details.
After installing patches, you can execute the patching-tool info
command to
verify them.
During the installation, patching-backup-deps.zip
and patching-backup.zip
files are created and stored in the web application’s WEB-INF
folder. These
files are required to restore the Liferay DXP’s original state; removing them
disables patching.
The patching-backup.zip
file is necessary for installing future patches,
because the Patching Tool reverts the installed fix pack before installing a new
one. To revert the installed fix pack, it examines the contents of the
patching-backup.zip
to determine the changes that it needs to revert.
Handling Hotfixes and Patches
As stated previously, hotfixes are short term fixes provided as quickly as possible, and fix packs are larger bundles of hotfixes provided to all customers at regular intervals. If you already have a hotfix installed and the fix pack that contains that hotfix is released, the Patching Tool can manage this for you. Fix packs always supersede hotfixes; so when you install your fix pack, the hotfix it contains is uninstalled and the fix pack version is installed in its place.
The Patching Tool applies fixes to fix packs automatically. If a new (fixed) version of a fix pack is released, install it with the Patching Tool. The Patching Tool uninstalls the old fix pack and installs the new version in its place.
Fix Pack Dependencies
Some hotfixes depend on fix packs. If you attempt to install a hotfix that
depends on a fix pack, the Patching Tool notifies you. Go to the
Customer Portal
and obtain the hotfix dependency. Once all the necessary patches are available
in the patches
folder, the Patching Tool installs them.
Updating the Patching Tool
When a patch you’re trying to install requires a Patching Tool update, the
Patching Tool tells you. To update the Patching Tool, download the latest one
from the
Customer Portal.
Overwrite the existing Patching Tool by unzipping the new one to the
patching-tool
folder’s parent folder.
Cleaning Up
After you’ve performed your patching procedure (whether you’ve installed or removed patches), it’s important to clean up Liferay DXP’s cache of deployed code. This ensures that you’re using the revision you’ve just installed the patches for when you start the server. This is really easy to do.
To clear out the cached code, remove the contents of the [Liferay Home]/work
folder. Now you’re ready to start your server.