Attach Large Files

XWiki Standard has a new file-system attachment storage allowing you to add very large attachments to the wiki documents. This feature is disabled by default, but you can enable it by editing the xwiki.cfg file and by making the following changes under the Storage section:

#-# The attachment storage.
xwiki.store.attachment.hint=file

#-# The attachment versioning storage. Use 'void' to disable attachment versioning.
xwiki.store.attachment.versioning.hint=file

#-# The attachment recycle bin storage
xwiki.store.attachment.recyclebin.hint=file

In order for the changes to be taken into account, you will have to restart the server.

Next, you need to set the maximum size of the attachment. To do that, just edit the XWiki.XWikiPreferences page in "Objects" mode (e.g. ServerName/xwiki/bin/edit/XWiki/XWikiPreferences?editor=object) and replace the value of the "Maximum Upload Size" property with a huge number (for instance "999999999999").

ModifyMaximumUploadSize.png

Store Attachments on the Filesystem

In order to move the attached files from the database to the file-system, you can use the "Filesystem Attachment Porter" tool available here. You just have to download the snippet, edit it and copy the code in any wiki page, for instance in "XWiki.FSPorter".

The first step is to enable the file-system attachment storage as explained in the above section, then to restart the server. If the configuration is correct, when you navigate to "XWiki.FSPorter" you should see the following 3 lines colored in green:

* org.xwiki.store.legacy.store.internal.FilesystemAttachmentStore@3b69d6d3
* org.xwiki.store.legacy.store.internal.FilesystemAttachmentVersioningStore@2196d51e
* org.xwiki.store.legacy.store.internal.FilesystemAttachmentRecycleBinStore@3581b5cc

FSPorter.png

The attachments will be copied from the database into the permanent directory set for the servlet container. 

Note that the file-system porter will copy the attachments from the database to the storage folder but it will not delete the entries from the database. It is recommended to keep the attachments in the database that after the copy process finishes.

The "Dry Run" option allows you to do a simulation in order to check for corrupted attachments without necessarily having the file-system storage enabled.

The "Verbose" option displays each attachment as it is processed. 

Once you click the "Start" button, the script will work in 20 second chunks and print the results of each chunk. In order for the script to switch to the next chunk you will have to click the "Continue" button.

SwitchChunk.png

 

Related Pages

Search this space

 

Most popular tags

Failed to execute the [groovy] macro
  1. access rights
  2. activity stream
  3. annotation
  4. attachment
  5. comment
  6. Document Tree Macro
  7. export
  8. Extension Manager
  9. Flamingo skin
  10. global user
  11. Groovy event listener
  12. group
  13. nested page
  14. search
  15. skin
  16. syntax
  17. user
  18. user profile
  19. velocity macros
  20. wiki
  21. wysiwyg
  22. XWiki Applications
  23. xwikiattachment_archive table
  24. xwikiattachment table
  25. xwikiattrecyclebin table
  26. xwikiproperties table

[Display all tags from this space]