2 good news: - The snippet http://extensions.xwiki.org/xwiki/bin/view/Extension/Empty+Trash+Bin works fine in 2.7 for the current wiki, I confirm. - I've found the issue with my code (transaction not properly closed). I hope to publish it quickly but I've some refactoring and testing to do prior. 2011/10/5 Maxime Sinclair <[email protected]>:
Hi Vincent,
The code is based on this snippet. I just tried to extend it to support sub-wikis in a farm context. But I have to say that I didn't try it on a XE.
Maxime
2011/10/4 Vincent Massol <[email protected]>:
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&confirmation=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