LPS-51028

Resent version of https://github.com/rotty3000/liferay-portal/pull/668 rebased against current mater