Issue
- How to recover the default functions on the Live site if your remote Staging site was either deleted or not disabled correctly?
Environment
- Liferay DXP 7.2
Resolution
- By running a groovy-script the Live site's default functions can be enabled.
- Before going further, please create a back-up of your database. As the resolution will make changes to the database, it is necessary to have it saved for security reasons.
- Start two vanilla Liferay 7.2 bundles with separate databases.
- Create in bundle1 a site called 'Staging' and in bundle2 a site called 'Live'. Connect these via Remote Staging.
- Delete in bundle1 --> 'Staging'.
- Go to bundle2 --> 'Live'. Here you will notice inside Control Panel --> Content, that you cannot add a new web content article. This is due to the fact that your 'Live' site wasn't disabled from the 'Staging' site.
- In order to be completely sure, please verify your database from bundle2. In your 'Live' site --> 'group_' table verify the 'remoteStagingGroupCout' column. If the value is '0', then the resolution of this article won't help. If the value is '1' then please continue with the next steps.
- Navigate to Control Panel --> Configuration --> Server Administration --> Scripts. Here copy and paste the below code and execute it:
import com.liferay.portal.kernel.service.GroupLocalServiceUtil;
long liveGroupId = [SiteID];
try {
GroupLocalServiceUtil.disableStaging(liveGroupId);
println("Staging disabled.");
}
catch(Exception e) {
println("Could not disable staging.");
}
- In order to actually run the script please replace the '[SiteID]' with the actual SiteID value.
- What this will do is that it will set the 'remoteStagingGroupCout' to the value '0', which means that your specific site is not connected to any other site via Remonte Staging.
Additional Information
- The above approach can work for Liferay Portal 6.2, Liferay DXP 7.0, and Liferay DXP 7.1. However, the script might require minor changes, due to the package name (com.liferay.portal.kernel.service.GroupLocalServiceUtil) changes from one Liferay version to another. Please feel free to contact the Customer Support team for any questions.