Wiki source code of Import/Export

Version 23.1 by Silvia Macovei on 2014/12/09

Hide last authors
Sorin Burjan 13.2 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
Vincent Massol 1.1 4
Manuel Smeria 17.3 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:
Vincent Massol 21.2 14 * {{info}}New in XWiki 5.0+{{/info}} If your wiki is empty and this is your first import, you will need [[to log in as ##superadmin##>>platform:AdminGuide.Configuration#HEnablesuperadminaccount]] to do the first import since there are no users defined in the wiki at this time.
Ludovic Dubost 8.1 15 * A configured database and Servlet Container. If you don't have them, see the [[Installation guide>>AdminGuide.Installation]].
16
Manuel Smeria 16.2 17 Follow these steps:
Dmitry Bakbardin 18.1 18
Vincent Massol 1.4 19 * Ensure your database and container are started
Dmitry Bakbardin 18.1 20 * Point your browser to ##http:~/~/localhost:8080/xwiki/bin/admin/XWiki/XWikiPreferences## or hover over "Wiki" and click on "Administer Wiki"
Manuel Smeria 16.2 21 * Click on "Import"
Dmitry Bakbardin 18.1 22 * 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):(((
Silvia Macovei 15.3 23 {{image reference="ImportPackageColibri.png"/}}
Manuel Smeria 17.2 24 )))
Manuel Smeria 16.2 25 * 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"
26 * Click "Import". This will import all the selected pages
Vincent Massol 1.4 27 * 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 17.2 28
Dmitry Bakbardin 18.1 29 {{info}}
Dmitry Bakbardin 19.1 30 If you own the sub-wiki (virtual wiki, wiki-farm), you need to be sure that you either:
31 * install with a global user having Programming Rights (PR) and UNCHECK the backup pack option
32 * install with a global user having PR and keep the backup pack option but in this case MAKE SURE that the user defined in the XAR exists and has PR.
33 Otherwise all imported pages would be saved without PR and scripts won't work until you resave them under the user with Programming Rights .
Dmitry Bakbardin 18.1 34
35 Note, that pages requiring PR are supposed to also contain a XWiki.RequiredRightClass xobject so it should be easy to query them. If you find some that don't have this XObject please let us know. This XObject is just indicative and doesn't change permissions.
36 {{/info}}
37
Sorin Burjan 13.2 38 {{warning}}
Manuel Smeria 16.2 39 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:
40 * 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//
41 * For Tomcat you must set //CATALINA_OPTS// to something like //-Xmx1024m//
Sorin Burjan 13.2 42 {{/warning}}
gus27 1.17 43
Silvia Macovei 11.4 44 = Exporting XWiki pages =
Guillaume Fenollar 6.1 45
Vincent Massol 1.4 46 Prerequisites:
Dmitry Bakbardin 18.1 47
Manuel Smeria 16.2 48 * A configured database and Servlet Container. If you don't have them, see the [[Installation guide>>AdminGuide.Installation]].
Vincent Massol 1.4 49
Manuel Smeria 16.2 50 Follow these steps:
Dmitry Bakbardin 18.1 51
Vincent Massol 1.4 52 * Ensure your database and container are started
Dmitry Bakbardin 18.1 53 * Point your browser to ##http:~/~/localhost:8080/xwiki/bin/admin/XWiki/XWikiPreferences##
Manuel Smeria 16.2 54 * Click "Export" and fill the form
Dmitry Bakbardin 18.1 55 * Click "Export"(((
Silvia Macovei 15.3 56 {{image reference="ExportPackageColibri.png"/}}
Manuel Smeria 17.2 57 )))
Dmitry Bakbardin 18.1 58
Silvia Macovei 11.4 59 == Customizing a XAR ==
Guillaume Lerouge 1.7 60
Ludovic Dubost 8.1 61 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 62
Manuel Smeria 16.2 63 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:
Dmitry Bakbardin 18.1 64
Guillaume Lerouge 1.8 65 * Unzip the file
66 * Keep the pages you want to put in your archive
Manuel Smeria 16.2 67 * Edit ##package.xml## to delete the pages you do not want to be in the archive
68 * 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
69 * You're done! You can now import this specific set of pages to any XWiki instance
Vincent Massol 1.9 70
Sorin Burjan 13.2 71 {{info}}
Vincent Massol 14.1 72 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 73 {{/info}}

Get Connected