Wrong Size Attachments
Last modified by Anca Luca on 2021/03/18 11:28
Finds corrupted attachments in the wiki |
Type | Snippet |
Category | |
Developed by | xwiki:XWiki.cjdelisle |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
{{velocity}}
=Mismatched Attachments=
|=Document name|=Attachment name|=Declared size|=Actual size
#foreach($attach in $xwiki.search("select doc.fullName, attach.filename, attach.filesize, length(content.content) from XWikiDocument as doc, XWikiAttachment as attach, XWikiAttachmentContent as content where content.id = attach.id and attach.docId = doc.id and attach.filesize != length(content.content)"))
|[[$attach.get(0)]]|$attach.get(1)|$attach.get(2)|$attach.get(3)
#end
=Missing Attachments=
|=Document name|=Attachment name|=Declared size
#foreach($attach in $xwiki.search("select doc.fullName, attach.filename, attach.filesize from XWikiDocument as doc, XWikiAttachment as attach where not exists(from XWikiAttachmentContent as content where content.id = attach.id) and attach.docId = doc.id"))
|[[$attach.get(0)]]|$attach.get(1)|$attach.get(2)
#end
{{/velocity}}
=Mismatched Attachments=
|=Document name|=Attachment name|=Declared size|=Actual size
#foreach($attach in $xwiki.search("select doc.fullName, attach.filename, attach.filesize, length(content.content) from XWikiDocument as doc, XWikiAttachment as attach, XWikiAttachmentContent as content where content.id = attach.id and attach.docId = doc.id and attach.filesize != length(content.content)"))
|[[$attach.get(0)]]|$attach.get(1)|$attach.get(2)|$attach.get(3)
#end
=Missing Attachments=
|=Document name|=Attachment name|=Declared size
#foreach($attach in $xwiki.search("select doc.fullName, attach.filename, attach.filesize from XWikiDocument as doc, XWikiAttachment as attach where not exists(from XWikiAttachmentContent as content where content.id = attach.id) and attach.docId = doc.id"))
|[[$attach.get(0)]]|$attach.get(1)|$attach.get(2)
#end
{{/velocity}}