Hi, I as well was interested in such script, so thanks for the hint. I've installed GroovyConsole application, however when clicking on "Execute" button nothing happens (well, almost nothing - in Firefox 7 I don't see any changes, in IE9 and Chrome when clicking the button, an image placeholder appears next to the button pointing to /xwiki/skins/colibri/icons/ajax-loader.gif, but the image itself does not get loaded). Maybe this issue is related to not setting proper programming rights on the page(s) but I don't understand how to do it. Regards, Roman -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Vincent Massol Sent: Tuesday, October 04, 2011 22:57 PM To: XWiki Users Subject: Re: [xwiki-users] Deleting all the documents of the recycle bin of a subwiki Hi Maxime, I haven't had the time to read your email below but here's a script to delete documents from the recycle bin: http://extensions.xwiki.org/xwiki/bin/view/Extension/Empty+Trash+Bin Thanks -Vincent PS: I've never tried it so don't know if it works or not but would be good to know... On Oct 4, 2011, at 6:57 PM, Maxime Sinclair wrote:
Hi,
Context: a 2.7.2 XEM farm
I'm trying to permanently suppress all the deleted docs of one of the wiki of the farm using a groovy script included in a page located in the main wiki.
This is the code. It's a draft... A db query retrieve the list of the deleted docs (I think it would be better to use the API to obtain this list), then each document is deleted using the RecycleBinStore.
def emptyDocBin(wiki) { xcontext.setDatabase(wiki) def workWiki = xcontext.getXWiki() def query = "SELECT DISTINCT XDD_FULLNAME FROM " + wiki + ".XWIKIRECYCLEBIN" def docsResult = runQuery(query) if (docsResult.size() > 0) { for (doc in docsResult) { def docName = doc.get("XDD_FULLNAME") workWiki.getDeletedDocuments(docName, "", xcontext.context).each{ println "Deleting : " + it.fullName + " - " + it.getDate() + " - " + it.id workWiki.getRecycleBinStore().deleteFromRecycleBin( workWiki.getDocument(it.fullName,xcontext.context), it.getId(), xcontext.context, true); } } } xcontext.setDatabase(xcontext.getOriginalDatabase()) }
All is working fine, a list of deleted docs is displayed BUT nothing is deleted and the documents are still present in the recycle bin.
In the xwiki.log, I can read this kind of "things":
2011-10-04 18:51:43,319 [http://www.lclh.org/bin/view/Admin/ShrinkRecycleBins?w=calife&confirm ation=1] [http://www.lclh.org/bin/view/Admin/ShrinkRecycleBins?w=calife&confirmation=1] WARN store.XWikiHibernateBaseStore - Cleanup of session was needed: SessionImpl(PersistenceContext[entityKeys=[EntityKey[com.xpn.xwiki.doc .XWikiDeletedDocument#6], EntityKey[com.xpn.xwiki.doc.XWikiDeletedDocument#11], EntityKey[com.xpn.xwiki.doc.XWikiDeletedDocument#12], EntityKey[com.xpn.xwiki.doc.XWikiDeletedDocument#32], EntityKey[com.xpn.xwiki.doc.XWikiDeletedDocument#33], EntityKey[com.xpn.xwiki.doc.XWikiDeletedDocument#1], EntityKey[com.xpn.xwiki.doc.XWikiDeletedDocument#36], EntityKey[com.xpn.xwiki.doc.XWikiDeletedDocument#37], EntityKey[com.xpn.xwiki.doc.XWikiDeletedDocument#4], EntityKey[com.xpn.xwiki.doc.XWikiDeletedDocument#34], EntityKey[com.xpn.xwiki.doc.XWikiDeletedDocument#35]],collectionKeys=[ ]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]]) 2011-10-04 18:51:43,321 [http://www.lclh.org/bin/view/Main/] [Statistics storing daemon] ERROR xwiki.DocumentStatsStoreItem - Failed to save visit statictics object [class com.xpn.xwiki.stats.impl.xwiki.VisitStatsStoreItem XWiki.Admin DJ64XAIYEJIPIXOADG9VMJ94RHOHD2U2 DJ64XAIYEJIPIXOADG9VMJ94RHOHD2U2] 2011-10-04 18:51:43,321 [http://www.lclh.org/bin/view/Main/] [Statistics storing daemon] WARN store.XWikiHibernateBaseStore - Incompatible session (null) and transaction (org.hibernate.transaction.JDBCTransaction@d9a754) status
Your help, ideas or other are welcome.
Maxime _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users