Wiki source code of Attachments
Version 1.1 by Caleb James DeLisle on 2011/04/18
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | Attachments can be uploaded either through the regular [[upload action>>platform:Features.Attachments]], [[platform:Features.WebDAV]], [[platform:Features.XMLRPC]] or [[Rest>>platform:Features.XWikiRESTfulAPI]]. | ||
2 | As an administrator you can set limits on the maximum size of an attachment and where the attachments will be stored. | ||
3 | |||
4 | = Size Limit = | ||
5 | The maximum size of an attachment is limited by a a configuration parameter in XWikiPreferences document. It is set to about 10MB by default. | ||
6 | To change it: | ||
7 | 1. Go to <yourwiki>/xwiki/bin/edit/XWiki/XWikiPreferences?editor=object | ||
8 | 2. Click on the line that says ##XWikiPreferences 0## (right below the line that says ##Objects of type XWiki.XWikiPreferences (1)##) | ||
9 | 3. Scroll down to the field that says ##Maximum Upload Size## and change the number to whatever size you want (it is expressed in bytes) | ||
10 | 4. Scroll to the bottom and click save. | ||
11 | |||
12 | = Attachment Storage = | ||
13 | XWiki offers plugin attachment storage mechanisms so you can store your attachments in the database or directly in the filesystem. | ||
14 | |||
15 | No matter what type of attachment store you use, the meta-data for the attachment will be saved in the [[xwikiattachment>>platform:DevGuide.DsXWikiAttachment]] table for faster loads. | ||
16 | |||
17 | == Database Attachment Store (Default) == | ||
18 | This attachment storage mechanism stores your attachments in database entries in the [[xwikiattachment_content>>platform:DevGuide.DsXWikiAttachmentContent]], [[xwikiattachment_archive>>platform:DevGuide.XWikiAttachmentArchive]], and [[xwikiattrecyclebin>>platform:DevGuide.DsXwikiRecycleBin]] tables. This system allows for easy backup of your attachments by dumping the database and keeps all of your data together but attachment size is memory constrained since the attachment content and archive must all be held in memory. As a general rule, attachments larger than 30MB are not possible. | ||
19 | |||
20 | == Filesystem Attachment Store (Since XWiki Enterprise 3.0M2) == | ||
21 | |||
22 | {{warning}} | ||
23 | The Filesystem Attachment Store is still in beta, it has passed all of our tests with flying colors but we need your help to make absolutely sure that everything is right before turning it on by default. | ||
24 | {{/warning}} | ||
25 | |||
26 | The Filesystem attachment store saves your attachments in files in a directory tree, this means you will have one more thing to do when you back up your data but it also means you can save larger (over one gigabyte) files. Filesystem attachment store implements a two stage commit mechanism to maintain integrity even if the database fails to commit the attachment meta-data. | ||
27 | |||
28 | === Directory Structure === | ||
29 | |||
30 | [[image:FilesystemAttachmentStoreDirtree.png||height=300px]] | ||
31 | |||
32 | The Filesystem Attachment Store puts your attachments into a directory tree on the hard disk, the directory structure is designed to be intuitive to navigate but you should **never add or remove anything**. Each attachment is accompanied by a piece of meta-data in the database and modifying the content in the filesystem store manually will lead to meta-data with no content or content with no meta-data. | ||
33 | |||
34 | === New users === | ||
35 | If you are a new XWiki user, all you need to do for enabling Filesystem Attachment Store is to change some settings in the [[xwiki.cfg file>>platform:AdminGuide.Configuration#HSamplexwiki.cfg]]. | ||
36 | These settings should read as follows: | ||
37 | |||
38 | {{code language="none"}} | ||
39 | xwiki.store.attachment.hint = file | ||
40 | xwiki.store.attachment.versioning.hint = file | ||
41 | xwiki.store.attachment.recyclebin.hint = file | ||
42 | {{/code}} | ||
43 | |||
44 | Also make sure they are not commented out. | ||
45 | |||
46 | === Users who already have a running wiki and want to switch to Filesystem Attachment Store === | ||
47 | If you already have a wiki and want to take advantage of the Filesystem Attachment Store, you should use the [[extensions:Extension.Filesystem Attachment Porter]] to move your existing attachments onto the filesystem. | ||
48 | |||
49 | === Other considerations === | ||
50 | * If you are running a [[cluster>>platform:AdminGuide.Clustering]] you will need for each node to have a synchronized storage directory, you can use NFS or another means to mount the disk on each node in the cluster. |