Wiki source code of Import/Export

Version 16.2 by Manuel Smeria on 2012/12/12

Hide last authors
Sorin Burjan 13.2 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
Vincent Massol 1.1 4
Manuel Smeria 16.2 5 This feature allows you to export one or several pages from your wiki into a **XAR** file (**X**wiki **AR**chive) or to import one or several pages from an existing XAR file. This is useful for moving wiki pages from one instance to another or to perform lightweight backup of your wiki pages.
Vincent Massol 1.1 6
Manuel Smeria 16.2 7 {{warning}}
8 This feature doesn't replace a [[proper backup>>Backup]].
9 {{/warning}}
Vincent Massol 16.1 10
Silvia Macovei 11.4 11 = Importing XWiki pages =
Vincent Massol 1.3 12
Vincent Massol 1.1 13 Prerequisites:
Ludovic Dubost 8.1 14 * A configured database and Servlet Container. If you don't have them, see the [[Installation guide>>AdminGuide.Installation]].
15
Manuel Smeria 16.2 16 Follow these steps:
Vincent Massol 1.4 17 * Ensure your database and container are started
Manuel Smeria 16.2 18 * Point your browser to ##http:~//localhost:8080/xwiki/bin/admin/XWiki/XWikiPreferences## or hover over "Wiki" and click on "Administer Wiki"
19 * Click on "Import"
20 * Attach the XAR file you wish to import and then **select it from the list** under "Available packages". After a few seconds you should see the list of all the pages in your XAR listed and selected by default (unselect the pages/folders you don't wish to import):
Vincent Massol 1.1 21
Silvia Macovei 15.3 22 {{image reference="ImportPackageColibri.png"/}}
Vincent Massol 1.1 23
Manuel Smeria 16.2 24 * Select the second radio button if you want to replace the document history with the history from the imported package. If you don't select it the newly imported pages will have the revision "1.1"
25 * Click "Import". This will import all the selected pages
Vincent Massol 1.4 26 * At this stage your rights might have been changed as the import may have imported different rights. You may need to log out and log in again.
Manuel Smeria 16.2 27 (((
Sorin Burjan 13.2 28 {{warning}}
Manuel Smeria 16.2 29 If you get a 'Java heap space Out Of Memory exception' you'll need to increase the memory allocated to the JVM running XWiki. How you do this depends on the container you use:
30 * For Jetty you must change a line in ##start_xwiki.bat## (or ##start_xwiki.sh##) from //JAVA_OPTS=-Xmx300m// to something like //JAVA_OPTS=-Xmx1024m//
31 * For Tomcat you must set //CATALINA_OPTS// to something like //-Xmx1024m//
Sorin Burjan 13.2 32 {{/warning}}
Manuel Smeria 16.2 33 )))
gus27 1.17 34
Silvia Macovei 11.4 35 = Exporting XWiki pages =
Guillaume Fenollar 6.1 36
Vincent Massol 1.4 37 Prerequisites:
Manuel Smeria 16.2 38 * A configured database and Servlet Container. If you don't have them, see the [[Installation guide>>AdminGuide.Installation]].
Vincent Massol 1.4 39
Manuel Smeria 16.2 40 Follow these steps:
Vincent Massol 1.4 41 * Ensure your database and container are started
Vincent Massol 14.2 42 * Point your browser to ##http:~//localhost:8080/xwiki/bin/admin/XWiki/XWikiPreferences##
Manuel Smeria 16.2 43 * Click "Export" and fill the form
44 * Click "Export"
Vincent Massol 1.4 45
Silvia Macovei 15.3 46 {{image reference="ExportPackageColibri.png"/}}
Sorin Burjan 12.2 47
Silvia Macovei 11.4 48 == Customizing a XAR ==
Guillaume Lerouge 1.7 49
Ludovic Dubost 8.1 50 When doing an export, XWiki pages are saved using the XAR format. This is in fact a renamed ZIP format with a //package.xml// file containing metadata about the export. A typical XAR created when doing an export will include all the pages on your XWiki instance.
Guillaume Lerouge 1.7 51
Manuel Smeria 16.2 52 It is possible however to create a XAR that will include only the pages you want. This is useful when you want to export only the pages of a specific application. Here are the steps:
Guillaume Lerouge 1.8 53 * Unzip the file
54 * Keep the pages you want to put in your archive
Manuel Smeria 16.2 55 * Edit ##package.xml## to delete the pages you do not want to be in the archive
56 * Zip together the modified ##package.xml## file and the pages you want to put together in your archive, naming the file "MyArchive".xar where "MyArchive" is the actual name you want to give it
57 * You're done! You can now import this specific set of pages to any XWiki instance
Vincent Massol 1.9 58
Sorin Burjan 13.2 59 {{info}}
Vincent Massol 14.1 60 In the future XWiki will offer the ability to do selective exports natively. For the moment you'll need to install the [[Multipage Export Extension>>extensions:Extension.Multipage Export Application]].
Sorin Burjan 13.2 61 {{/info}}

Get Connected