Regards,
Roman
-----Original Message-----
From: users-bounces(a)xwiki.org [mailto:users-bounces@xwiki.org] 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:
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&confirmat…]
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
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org
_______________________________________________
users mailing list
users(a)xwiki.org