Wiki source code of ImportExport

Version 3.1 by Jean-Vincent Drean on 2008/07/11

Hide last authors
Vincent Massol 1.1 1 1 Import/Export Tool
2
Vincent Massol 2.4 3 This tools allows you to export one or several pages from your wiki into a XAR file (Xwiki ARchive) or to import one or several pages from an existing XAR file. This is very useful for backing up your wiki and for restoring a wiki from scratch (see also the [Backup guide>Backup] for more information on backups).
Vincent Massol 1.1 4
Vincent Massol 1.3 5 #toc("" "" "")
6
Vincent Massol 1.1 7 1.1 Importing XWiki pages
8
9 Prerequisites:
Vincent Massol 1.11 10 * A configured database and Servlet Container. If you don't have them, see the [Installation guide>AdminGuide.Installation].
Vincent Massol 1.1 11
12 Follow the steps:
Vincent Massol 1.4 13 * Ensure your database and container are started
Jean-Vincent Drean 3.1 14 * Point your browser to http://localhost:8080/xwiki/bin/admin/XWiki/XWikiPreferences or click on the "Administration" link in the top right (if you're using the [Albatross>platform:Features.Skins] or [Toucan>platform:Features.Skins] skin)
15 * Click on the Import icon. You should see the following screen:
Vincent Massol 1.1 16
17 {image:importpage.png}
18
Vincent Massol 1.20 19 * Attach the XAR file you wish to import and then *select it in the list*. After a few seconds you should see the list of all the pages in your XAR listed and selected by default (unselect if you wish not to import some pages).
Jeremie Bousquet 1.19 20 * Select option "with history" if you want to preserve imported pages history. If not checked newly imported pages will have revision "1.1".
Vincent Massol 1.1 21 * Click on the Import button. This will import all the selected pages.
Vincent Massol 1.4 22 * 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.
Vincent Massol 1.1 23
Vincent Massol 1.16 24 #warning("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.
25 * For Jetty you edit a line in start_xwiki.bat (or start_xwiki.sh) from ~~JAVA_OPTS=-Xmx300m~~ to something like ~~JAVA_OPTS=-Xmx1024m~~
gus27 1.17 26 * For Tomcat you set ~~CATALINA_OPTS~~ to something like ~~-Xmx1024m~~.")
Vincent Massol 1.13 27
gus27 1.17 28
Vincent Massol 1.3 29 1.1 Exporting XWiki pages
30
Vincent Massol 1.4 31 Prerequisites:
32 * A configured database and Servlet Container. If you don't have them, see the [Installation>AdminGuide.Installation].
33
34 Follow the steps:
35 * Ensure your database and container are started
36 * Point your browser to http://localhost:8080/xwiki/bin/admin/XWiki/XWikiPreferences
Jean-Vincent Drean 3.1 37 * Click on the Export icon and fill the form
Vincent Massol 1.4 38 * Click on the Export button.
39
Guillaume Lerouge 1.7 40 1.1.1 Customizing a XAR
41
Vincent Massol 1.9 42 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 43
Guillaume Lerouge 1.8 44 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:
45 * Unzip the file
46 * Keep the pages you want to put in your archive
47 * Edit package.xml to delete the pages you do not want to be in the archive
48 * Zip together the modified package.xml file and the pages yo uwant to put together in your archive, naming the file "MyArchive".xar where "MyArchive" is the actual name you want to give it.
49 * You're done! You can now import this specific set of pages to any XWiki instance.
Vincent Massol 1.9 50
51 #info("In the future XWiki will offer the ability to do selective exports.")
52

Get Connected