How to force disable staging via Groovy script

Issue

  • If a customer clones a remote staging environment live site the customer will not be able to disable staging. Disable can be forced via Groovy Script.

Environment

  • Portal 6.2

Resolution

  • First get the site ID. Go to Admin > Configuration. Take note of the Site ID value.
  • To execute the script go to Admin > Control Panel > Server administration > Script tab
  • Select Groovy on the Language drop-down menu.
  • Erase all box content and put:
import com.liferay.portal.service.GroupLocalServiceUtil;

long liveGroupId = [SiteID];
try{
 GroupLocalServiceUtil.disableStaging(liveGroupId);

 System.out.println("Staging disabled.");

}catch(Exception e){

 System.out.println("Could not disable staging.");

}
  • Be sure to replace [SiteID] with the Site ID vale noted.
  • Click on Execute

Additional Information

  • On the logs it should appear:
    Staging disabled.
这篇文章有帮助吗?
0 人中有 0 人觉得有帮助