Fixing issue with Site Templates in Liferay 6.1


This is another in my occasional series of Liferay posts. We are moving towards a larger deployment of Liferay within the Law School. Sometimes, things bite us. This is an example of one such thing, along with a work-around.


It’s easy to attach a site template to a site in Liferay 6.1. However, there is no GUI for detaching a site template from a site, or at least I’m not aware of one. If you are, please share. Because we made a sort of fundamental mistake when creating some site templates, we needed this functionality. Here’s my beginner-to-Liferay way of accomplishing that. Below is a screenshot of what the site template selection screen in Site Settings looks like after you mistakenly attach a Site Template to the private pages for the site that you no longer want.

The way that I fixed this is undoubtedly incorret, wrong, bad, etc. I’m only documenting it so that I will remember if I need to figure this out again at some point. We are Liferay customers and use the EE version of Liferay 6.1.

Determining what tables hold the data that you’re interested in


Get a list of tables that might have something to do with pages or layouts.
In Liferay, a “Layout” is a page, containing portlets, etc.
A “LayoutSet” is a web-site comprised of pages(“Layouts”). See the entry in the Liferay Wiki.
A “LayoutSetPrototype” is a “Site Template”.

Describe LayoutSetPrototype


LayoutSetPrototype’s description field contains human-readable description. This is why you should fill in the description. Makes it much easier to find the proper LayoutSetPrototype. Try this to get a list of UUIDs and descriptions:

select description,uuid_ from LayoutSetPrototype; 

Match Prototype UUID to LayoutSet

Assume that we’re interested in the SiteTemplate that has the description, “This is the default standard site for Emory Law School Organization private pages.” Run this query:

select layoutSetId,groupId from LayoutSet where layoutSetPrototypeUuid = "f41c0678-4e93-431e-99d3-9547cefe8704"\G

*************************** 1. row *************************** layoutSetId: 92053 groupId: 92052 *************************** 2. row *************************** layoutSetId: 142428 groupId: 142427 *************************** 3. row *************************** layoutSetId: 166454 groupId: 166453 3 rows in set (0.00 sec)

Figure out which LayoutSet is the correct one.


Notice that there is a match above for “groupId” on the “Site ID” displayed below. It looks like the layoutSetId is one greater; this also makes some sense as template involved in this exercise is attached to the “private” pages of the site in question.

Break the relationship between the Site Template and the Site

Do not try this at home. Do not use this on data that you care about. Back up your data, etc. I’m sure this is the wrong way to do this. But this is the way that we broke the relationship between the site templates and our site. This enabled us to select a new site template. Continuing with the previous example:

update LayoutSet set layoutSetPrototypeUuid = NULL,layoutSetPrototypeLinkEnabled = NULL where groupId = 

Further proof that this is not the correct way to do things: because of some sort of caching issue, you will need to restart Liferay before this change will be recognized.

Again, your mileage may vary, etc. I’m only demonstrating this because it worked for us and solved a particular problem that we were having. If we ever implement a proper Java-based solution to the issue, I’ll share. I hope/assume that the next Liferay version will incorporate some sort of GUI functionality to accomplish the same thing. I have been told by Liferay support that the failure to provide a method to undo the linkage between a site template and site is actually a feature designed to protect data. If you know more about the details of that assertion, I would be glad to hear about it.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s