Wrong Size Attachments

Last modified by Anca Luca on 2021/03/18 11:28

cogFinds corrupted attachments in the wiki
TypeSnippet
Category
Developed by

xwiki:XWiki.cjdelisle

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents

Description

This script works on MySQL but currently doesn't work on HSQLDB - There's a factor of 2 between reported Declared Sizes and Actual Sizes.

{{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}}
Tags:
Created by Vincent Massol on 2010/12/10 12:16
     

Get Connected