Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Luis Mas
Asset publisher lost scope settings after upgrading from 6.1.0 to 6.1.1
August 13, 2012 3:42 PM
Answer

Luis Mas

Rank: Regular Member

Posts: 146

Join Date: May 18, 2009

Recent Posts

I upgraded a liferay portal from version 6.1.0 to 6.1.1, and portlet preferences of asset publisher were changed to default_scope, so some content is not shown in many pages.

Is there anybody that experienced the same problem? Is there any workaround?
Henry K
RE: Asset publisher lost scope settings after upgrading from 6.1.0 to 6.1.1
August 14, 2012 9:26 AM
Answer

Henry K

Rank: Junior Member

Posts: 40

Join Date: January 27, 2010

Recent Posts

I got this result as well. All of the site's manual asset publishers are broken. In the configuration screen I see this error message:

The selected asset(s) have been removed from the list because they do not belong in the scope of this portlet.

The code that generates the scopes looks similar from 6.1.0 to 6.1.1 but overall there are huge changes to configuration.jsp...
Luis Mas
RE: Asset publisher lost scope settings after upgrading from 6.1.0 to 6.1.1
August 14, 2012 10:18 AM
Answer

Luis Mas

Rank: Regular Member

Posts: 146

Join Date: May 18, 2009

Recent Posts

Yes, exactly the same message. And if you go to automatically selected ones, some of them aren't showing. It behaves abnormaly.

In all of the asset pubilshers portlets, Scope is not selected.

What I can see is that in LR610 Scope looks like this
- <name>defaultScope</name><value>10180</value>
- <name>scopeIds</name><value>Group_10180</value>

and in LR611 like this (after assignining manually the scope)
- <name>defaultScope</name><value>Group_default</value>
- <name>scopeIds</name><value>Group_default</value>
Luis Mas
RE: Asset publisher lost scope settings after upgrading from 6.1.0 to 6.1.1
August 14, 2012 12:37 PM
Answer

Luis Mas

Rank: Regular Member

Posts: 146

Join Date: May 18, 2009

Recent Posts

I upgraded again and changed in portlet preferences:

- <name>defaultScope</name><value>10180</value>
- <name>scopeIds</name><value>Group_10180</value>

by

- <name>defaultScope</name><value>Group_10180</value>
- <name>scopeIds</name><value>Group_10180</value>

and it worked...
Henry K
RE: Asset publisher lost scope settings after upgrading from 6.1.0 to 6.1.1
August 14, 2012 2:56 PM
Answer

Henry K

Rank: Junior Member

Posts: 40

Join Date: January 27, 2010

Recent Posts

Great find, Luis, thank you!

Here's some code I just whipped up to fix this programmatically, just have to place it into init.jsp in an asset publisher hook. It seems to work.

if (Validator.isNotNull(portletResource)) {
preferences = PortletPreferencesFactoryUtil.getPortletSetup(request, portletResource);
}

Map map = preferences.getMap();
Iterator itr=map.entrySet().iterator();
while (itr.hasNext()){
Map.Entry entry = (Map.Entry)itr.next();
try{
System.out.println(entry.getKey() + ":" + Arrays.toString((String[])entry.getValue()));
}catch(Exception e){
System.out.println(entry.getKey() + ":" + Arrays.toString((long[])entry.getValue()));
}

if(entry.getKey().equals("defaultScope")){
String[] val = (String[])entry.getValue();
for(String s: val){
if(!s.startsWith("Group_")){
String newVal = "Group_" + s;
preferences.setValue("defaultScope",newVal);
}
}
}
}
Aniceto P Madrid
Fix
August 29, 2012 1:59 AM
Answer

Aniceto P Madrid

Rank: Regular Member

Posts: 135

Join Date: May 24, 2008

Recent Posts

Hi

The Henry fix was inspiring, but it requires the fix every time an asset is loaded. I tried to fix it and save the preferences to disminish the load, but than can onle be done if the logged user has portlet preferences edit permission.
So, I have developed the fix as a portlet. Attached are the sources and a deployable war. The packaging as a portlet is because just after installation, Liferay calls the init() method and in that phase, the thread has all the required permissions. You only have to wait for the portal to end startup, deploy this portlet and look at the server log. You will see the fixing activity. When fixing has finished, you will have to uninstall the portlet. The restart of the portal with this portlet installed will only slow down the start, but won't do anything. This portlet may be deployed on a page, but it is useless, because it only works during the initialization phase.
If there is any question, please let me know infoinnovasoftps.com.

Regards
Attachments: FixAssetP610_611-portlet-6.1.1.1.war (23.8k), FixAssetP610_611-portlet.zip (28.7k)