留言板

How can I remove a portlet from all the pages and then undeploy

thumbnail
Prakash Khanchandani,修改在12 年前。

How can I remove a portlet from all the pages and then undeploy

Expert 帖子: 329 加入日期: 11-2-10 最近的帖子
Hi All,

Is there a way in liferay where I can just undeploy a particular portlet and it gets removed from all the pages where it was added.

Currently, I have to manually delete the portlet from each and every page on which it is placed and then undeploy from Update Manager or delete it from webapps.

I am using: Liferay CE 6.0.6 with tomcat.

Thank you

Regards,
Prakash
thumbnail
Prakash Khanchandani,修改在12 年前。

RE: How can I remove a portlet from all the pages and then undeploy

Expert 帖子: 329 加入日期: 11-2-10 最近的帖子
Is this possible at all?

Your answer would be highly appreciated.

Thanks
thumbnail
Jignesh Vachhani,修改在12 年前。

RE: How can I remove a portlet from all the pages and then undeploy

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
Hi Prakash,
Both procedure are same , internally it will delete the folder from webapps only.
So just delete it from webapps folder.
thumbnail
Prakash Khanchandani,修改在12 年前。

RE: How can I remove a portlet from all the pages and then undeploy

Expert 帖子: 329 加入日期: 11-2-10 最近的帖子
Thanks Jignesh.

But I guess I was not clear enough with my question.

I am not asking which is better:
1) Deleting directly from webapps or
2) Undeploying from Update Manager.
Instead I am asking:
Is there a way in liferay where I can just undeploy a particular portlet and it gets removed from all the pages whereever it was added?


For example:
1) I have created a custom portlet named: My Plugin Portlet
2) I have added this portlet to some pages, say 10 different pages in 5 different communities.
3) So now I undeploy this portlet without removing it from the 10 different pages on which it was added.
4) What happens is that the portlet is still there on those 10 different pages with this message: "This portlet has been undeployed. Please redeploy it or remove it from the page.". This message is not shown to the normal users, its only for the Admin users.

So what I want is not to go to each and every page to remove the portlet, instead I want a way in which liferay does it automatically while undeploying the portlet.

Thanks
thumbnail
Mauro Mariuzzo,修改在12 年前。

RE: How can I remove a portlet from all the pages and then undeploy

Regular Member 帖子: 142 加入日期: 07-7-23 最近的帖子
These functionality is not available out-of-the-box.

There are some things to consider.

You cannot attach to undeploy events. There is a property called "hot.undeploy.on.redeploy" (default false) controlling how a portlet is redeployed.
If this property is "true" you have no secure way to catch only real undeploy.

IMHO the best way is to create a plugin with a scheduled job (every 6 hour?) processing all layouts and validate "layoutTypeProperties" field
thumbnail
Ali Shahrami,修改在12 年前。

RE: How can I remove a portlet from all the pages and then undeploy

Junior Member 帖子: 52 加入日期: 09-8-1 最近的帖子
You can also inactivate portlet and set the following property to false:

#
# Set this to true if users are shown that a portlet is inactive. The
# portlet init parameter "show-portlet-inactive" will override this setting.
#
layout.show.portlet.inactive=false

As far as I know Liferay does not have the capability to remove portlet references from user pages (layout), when a portlet is undeployed. Unless you want to write an update procedure to manually remove updeployed portlet references from the Layout table.

Ali
Bob Fleischman,修改在12 年前。

RE: How can I remove a portlet from all the pages and then undeploy

Junior Member 帖子: 30 加入日期: 08-4-8 最近的帖子
Prakash:

I wrote a program for Liferay 5.2.3 that swapped one portlet for another. (We had devised a better portlet and needed to search through 1500 users private pages for the old portlet and switch in the new one.)

It can be done. You need to update PortalPreferences as well as the Layout tables.

Attached is the basic source code. Sorry it is not better commented but it was a one-shot use. If you find an error in the main it is just where we set up our JNDI connection to the lportal DB.

I assume (and hope) that most of the methodology can be applied to Liferay 6 (We are migrating this summer).

It's not something used often, but when you need it it really helps.

Hope this helps you.

Bob
thumbnail
Prakash Khanchandani,修改在12 年前。

RE: How can I remove a portlet from all the pages and then undeploy

Expert 帖子: 329 加入日期: 11-2-10 最近的帖子
@Mauro
Thanks for the reply, you wrote:
You cannot attach to undeploy events. There is a property called "hot.undeploy.on.redeploy" (default false) controlling how a portlet is redeployed.
If this property is "true" you have no secure way to catch only real undeploy.

Can you please elaborate a little bit more on the above, I couldn't understand as to how this will help me.

@Ali Shahrami
Thanks a lot for clearing this up a little. I will try this.

@Bob Fleischman
Thanks a ton for the code, I will surely try and get back to you.

@Everyone
I really love the way this community thing works, you all are really helpful emoticon