[xwiki-users] Purge Document Versions via Script

2009-01-21 Thread Tronicek

Is there a way to purge document revisions using Velocity or Groovy?

Someone can see actual and last revision by:
${doc.getVersion()}br
${doc.getPreviousDocument().getVersion()}br

The next is deleting the document with all revisions...
Don't try to purge with(!):
${doc.getPreviousDocument().delete()}

Thanks,
Rudolf
-- 
View this message in context: 
http://n2.nabble.com/Purge-Document-Versions-via-Script-tp2192579p2192579.html
Sent from the XWiki- Users mailing list archive at Nabble.com.

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Purge Document Versions via Script

2009-01-21 Thread KevinC

I'm guessing you could use something like:

http://code.xwiki.org/xwiki/bin/view/Snippets/DeleteSpaceSnippet

to build a listing of the files versions and then create links or checkboxes
or something like that to delete the ones you are interested in.

You can get the full list of versions using $doc.getRevisions() which
returns a org.suigeneris.jrcs.rcs.Version[]. You could then iterate through
that list and delete all versions but the last.


HTH,
.:. Kevin
-- 
View this message in context: 
http://n2.nabble.com/Purge-Document-Versions-via-Script-tp2192579p2192728.html
Sent from the XWiki- Users mailing list archive at Nabble.com.

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


Re: [xwiki-users] Purge Document Versions via Script

2009-01-21 Thread Jerome Velociter
If what you want to do is remove all old revisions from a document but 
keep the current one, you can use the following :

$doc.document.resetArchive($context.context);

It's not a public API, so you will need to save the page with a users 
who has the programming right granted

Hopes it helps,
Jerome

Tronicek wrote:
 Is there a way to purge document revisions using Velocity or Groovy?

 Someone can see actual and last revision by:
 ${doc.getVersion()}br
 ${doc.getPreviousDocument().getVersion()}br

 The next is deleting the document with all revisions...
 Don't try to purge with(!):
 ${doc.getPreviousDocument().delete()}

 Thanks,
 Rudolf

___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users