I have uploaded an image several times to the same Wiki page and I now what to remove “old revisions” of this attachment to keep / store only the last image. How can I perform this cleaning operation?
However due to Loading... this won’t remove associated attachment revisions…
You should be able to delete attachments using a script but I couldn’t find any example on snippets.xwiki.org or elsewhere. I tried looking at our API and didn’t find anything straightforward either. There’s XWikiAttachmentStoreInterface#deleteXWikiAttachment(XWikiAttachment attachment, ...)-.
Won’t this remove all revisions of the passed attachment? I think @xrichard’s question was about removing some revisions only. Do we have an API to remove some revs from an attachment?
I have uploaded an image several times to the same Wiki page and I now what to remove “old revisions” of this attachment to keep / store only the last image.
@tmortagne Removing “old revisions” seems clear to me, it’s about removing old revisions and I understand “keep / store only the last image.” as keeping the last revision only. Anyway @xrichard will confirm.
My question still stands:
Do we have an API to remove some revs from an attachment?
I’m used to clean some page revisions (through Page history), my initial request is “can we do the same for attachments”?
You can imagine the following case: some pages with a big file (zip) stored several times and only the last version should be kept. The easy workaround I see from my “end-user” point of view is:
delete attachment (and thus all its revisions)
upload again the last attachment only
Clean “Deleted Attachments view” (using All pages Index as admin).
By doing so I should both gain “space” and keep existing links to the attachment (the URL should not change if the last attachment keeps its original name).
It looks like this manual way to proceed is the only solution.
That does not exist no. You do have a history UI similar to the page one but it does not have the remove revision feature and this feature is not implemented in the attachment archive either.
Without writing any script that’s the easiest yes.