This script does it pretty well.
Please remember to back up your database first, this is a complicated operation not like
clearing a table column.
It takes a while on a small wiki so you may consider doing sections of pages be changing
the query ("1=1") to something like "where doc.fullName like
'a%'" then "where doc.fullName like 'b%'" etc.
{{groovy}}
import com.xpn.xwiki.objects.BaseObject;
xc = xcontext.getContext();
wiki = xc.getWiki();
for(String docName : xwiki.searchDocuments("1=1")) {
document = wiki.getDocument(docName, xc);
for (BaseObject obj : document.getComments()) {
document.removeObject(obj);
}
wiki.saveDocument(document, xc);
}
{{/groovy}}
Caleb
Alexis Hassler wrote:
Hi all,
My XWiki (v1.7.2.16857) Web site has been spamdexed, so several articles
have hundreds of fake comments.
I would like to know if it is possible to delete all the comments of an
article in one shot.
Thanx,
Alexis
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users