Changes for page Attachments

Last modified by Thomas Mortagne on 2023/10/10

From version 7.1
edited by Caleb James DeLisle
on 2011/04/18
Change comment: set parent
To version 8.1
edited by AdrianFita
on 2012/02/20
Change comment: add info about xwiki.work.dir

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.Caleb_James_DeLisle
1 +XWiki.AdrianFita
Content
... ... @@ -1,11 +1,15 @@
1 -{{box cssClass="floatinginfobox" title="**Contents**"}}{{toc/}}{{/box}}
1 +{{box cssClass="floatinginfobox" title="**Contents**"}}
2 +{{toc/}}
3 +{{/box}}
2 2  
3 3  Attachments can be uploaded either through the regular [[upload action>>platform:Features.Attachments]], [[platform:Features.WebDAV]], [[platform:Features.XMLRPC]] or [[Rest>>platform:Features.XWikiRESTfulAPI]].
4 4  As an administrator you can set limits on the maximum size of an attachment and where the attachments will be stored.
5 5  
6 6  = Size Limit =
9 +
7 7  The maximum size of an attachment is limited by a configuration parameter in XWikiPreferences document. It is set to about 10MB by default.
8 8  To change it:
12 +
9 9  1. Go to <yourwiki>/xwiki/bin/edit/XWiki/XWikiPreferences?editor=object
10 10  2. Click on the line that says ##XWikiPreferences 0## (right below the line that says ##Objects of type XWiki.XWikiPreferences (1)##)
11 11  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)
... ... @@ -12,24 +12,32 @@
12 12  4. Scroll to the bottom and click save.
13 13  
14 14  = Versions =
19 +
15 15  When a user uploads an attachment then uploads another attachment with the exact same name, you can decide whether or not to keep a version history of the attachments like you do with documents.
16 16  XWiki stores all document attachment versions by default which costs more storage space. If you need only latest versions of attachments, you can disable attachment version control by editing your [[xwiki.cfg>>platform:AdminGuide.Configuration#HSamplexwiki.cfg]] and adding:
17 17  
18 -{{code language="none"}}xwiki.store.attachment.versioning=0{{/code}}
23 +{{code language="none"}}
24 +xwiki.store.attachment.versioning=0
25 +{{/code}}
19 19  
20 20  = Deletion =
28 +
21 21  Deleted attachments are stored in a recycle bin so that they can be restored along with the document when rolling back or previewing an earlier version where the attachment should be visible. To disable this feature, edit xwiki.cfg and add:
22 22  
23 -{{code language="none"}}storage.attachment.recyclebin=0{{/code}}
31 +{{code language="none"}}
32 +storage.attachment.recyclebin=0
33 +{{/code}}
24 24  
25 25  You can view the list of deleted attachments in your wiki and delete them permanently by going to ##XWiki.DeletedAttachments## in your wiki.
26 26  
27 27  = Attachment Storage =
38 +
28 28  XWiki offers plugin attachment storage mechanisms so you can store your attachments in the database or directly in the filesystem.
29 29  
30 30  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.
31 31  
32 32  == Database Attachment Store (Default) ==
44 +
33 33  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.
34 34  **Note:** When using this attachment store with a MySQL database, you must set the ##max_allowed_packet## to about 3 times the size of your largest attachment since the attachment and it's version history must be saved. See [[platform:AdminGuide.InstallationMySQL]] for more information.
35 35  
... ... @@ -41,13 +41,24 @@
41 41  
42 42  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.
43 43  
56 +=== Filesystem attachment store location ===
57 +
58 +The directory in which the attachments are stored in the filesystem is defined with the parameter ##xwiki.work.dir## in the ##xwiki.cfg## file. You'll find it right at the end of the file. By default it's defined to just "data", which means the effective directory location in the filesystem will be created with the name //data// and will be relative to the directory from which the Java application server (Apache Tomcat) was started. For example, if you start Tomcat from /opt/tomcat6, xwiki's attachments directory is /opt/tomcat6/data; if you start Tomcat from /opt/tomcat6/bin, xwiki's attachments directory is /opt/tomcat6/bin/data, and so on.
59 +
60 +You'll want to define an absolute path(!!) for ##xwiki.work.dir##. Example:
61 +
62 +{{code}}
63 +xwiki.work.dir=/opt/tomcat6/data
64 +{{/code}}
65 +
44 44  === Directory Structure ===
45 45  
46 -[[image:FilesystemAttachmentStoreDirtree.png||height=300px]]
68 +[[image:FilesystemAttachmentStoreDirtree.png||height="300px"]]
47 47  
48 48  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.
49 49  
50 50  === New users ===
73 +
51 51  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]].
52 52  These settings should read as follows:
53 53  
... ... @@ -60,7 +60,9 @@
60 60  Also make sure they are not commented out.
61 61  
62 62  === Users who already have a running wiki ===
86 +
63 63  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.
64 64  
65 65  === Other considerations ===
90 +
66 66  * 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.

Get Connected