Forums

Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Aaron Paxson
Delete all blog entries in a community?
June 17, 2011 4:39 PM
Answer

Aaron Paxson

Rank: Regular Member

Posts: 103

Join Date: July 27, 2010

Recent Posts

How can I delete all blog entries in a community? I've imported my blog from Wordpress, but the comments did not seem to come over. I'd like to do it again. How do I delete my existing entries 150+ so that I can do it again?

Is it easy? Maybe just a SQL delete?

Thanks!
Ryan Park
RE: Delete all blog entries in a community?
June 17, 2011 5:07 PM
Answer

Ryan Park

LIFERAY STAFF

Rank: Regular Member

Posts: 104

Join Date: August 27, 2007

Recent Posts

Hi Aaron,

May I first advise NOT to do a SQL delete. Creating a Blog Entry also creates items in other tables and doing a SQL delete will cause them to become out of sync.

Unfortunately there isn't a button that will delete them all for you but using Server Administration scripts we can accomplish the same.

1. First go to Control Panel > Communities, and click on the community of the blog entries you'd like to delete.
2. Write down the its ID.
3. Now Go to the Control Panel > Portal Administration > Script
4. Copy and paste the below code and where ##### is the ID of the site you'd like to rid of Blog entries.
1Packages.com.liferay.portlet.blogs.service.BlogsEntryLocalServiceUtil.deleteEntries(#####);

5. Execute.

That should be it.
Aaron Paxson
RE: Delete all blog entries in a community?
June 18, 2011 10:03 AM
Answer

Aaron Paxson

Rank: Regular Member

Posts: 103

Join Date: July 27, 2010

Recent Posts

Heh. Ummm..... Ooops. Being as impatient as I am, I did go ahead and do a SQL delete. I hope I didn't do too much damage. My SQL was:

delete from BlogsEntry where companyId=11404;

I will definately keep that in mind next time. Again, hopefully, I don't have any orphaned entries. So far, I haven't noticed anything. Thanks for the response!!
Ryan Park
RE: Delete all blog entries in a community?
June 20, 2011 3:19 PM
Answer

Ryan Park

LIFERAY STAFF

Rank: Regular Member

Posts: 104

Join Date: August 27, 2007

Recent Posts

Hi Aaron,

You may have some issues that will crop up.

The easiest one I can think of is that the Social Activity will still show for those deleted items and will have a link to them. Those links are likely to be broken. If you can at all restore your DB and use the Admin Script I think you will be better off.

Other than that Good Luck with you installation.
-Ryan