Empty Trash Bin Snippet does not delete translations

Dear all,

we have huuuge amounts of deleted pages in our trash bin, and there is no “Delete All” Button.
(Is there a JIRA Feature for this to upvote?)

So I’ve tried this groovy snippet. It works, but it does not delete translations. This particular subwiki is “multilingual” in englisch and german, and only the default language versions have been emptied from the Trash bin.

{{groovy}}
def emptybin = 0 // set to 1 if you want to empty the trash bin for the whole wiki

def query = "select distinct ddoc.fullName from XWikiDeletedDocument as ddoc "
query += "where not exists (from XWikiDocument as doc where doc.fullName=ddoc.fullName)"
def trashed = xwiki.search(query)
if(trashed.size() > 0) {
  def deleted = 0
  println "<strong>Trashed documents:</strong>\n"
  for(trash in trashed) {
    println "* " + trash + " (" + xwiki.getDeletedDocuments(trash, "").size() + " versions)"
    if (emptybin == 1)
       xwiki.getDeletedDocuments(trash, "").each{
         xwiki.getXWiki().getRecycleBinStore().deleteFromRecycleBin(
             xwiki.getDocument(it.fullName).document,
             it.getId(),
             xcontext.context,
             true);
         deleted++;
       }
  }
  if (emptybin == 1) println "\nDeleted <strong>" + deleted + "</strong> trashed document. Trash bin is now empty."
}
else println "Everything's clean. No trashed document found."
{{/groovy}}

Would somebody be so kind and explain how to edit this so that translations are deleted too?
Thank you.

BR
Mario

Unfortunately the Admin Tools Application has the needed feature but outputs
Sorry, this script can't be run if the XWiki farm database is NOT MySQL. :frowning: