Wiki source code of Import/Export

Version 33.1 by Vincent Massol on 2020/08/17

Hide last authors
Sorin Burjan 13.2 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
Vincent Massol 1.1 4
Vincent Massol 31.3 5 This feature allows you to export one or several pages from your wiki into a [[**XAR** file>>extensions:Extension.XAR Module Specifications]] (**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
Vincent Massol 33.1 11 = Importing wiki pages =
Vincent Massol 1.3 12
Vincent Massol 33.1 13 This feature is brought by the [[Administration Application>>extensions:Extension.Administration Application]] and is documented in the [[Import section>>extensions:Extension.Administration Application#HImport]].
Thomas Mortagne 27.1 14
Vincent Massol 33.1 15 = Exporting wiki pages =
Ludovic Dubost 8.1 16
Vincent Massol 1.4 17 Prerequisites:
Dmitry Bakbardin 18.1 18
Ecaterina Moraru (Valica) 30.4 19 * A configured database and Servlet Container. If you don't have them, see the [[Installation guide>>Documentation.AdminGuide.Installation]].
Vincent Massol 1.4 20
Manuel Smeria 16.2 21 Follow these steps:
Dmitry Bakbardin 18.1 22
Vincent Massol 1.4 23 * Ensure your database and container are started
Dmitry Bakbardin 18.1 24 * Point your browser to ##http:~/~/localhost:8080/xwiki/bin/admin/XWiki/XWikiPreferences##
Manuel Smeria 16.2 25 * Click "Export" and fill the form
Dmitry Bakbardin 18.1 26 * Click "Export"(((
Silvia Macovei 24.1 27 {{image reference="ExportPackageFlamingo.png"/}}
Manuel Smeria 17.2 28 )))
Dmitry Bakbardin 18.1 29
Silvia Macovei 11.4 30 == Customizing a XAR ==
Guillaume Lerouge 1.7 31
Ecaterina Moraru (Valica) 30.4 32 When doing an export, XWiki pages are saved using the [[XAR format>>Documentation.AdminGuide.ImportExport||anchor="HXARFormat"]]. A typical XAR created when doing an export will include all the pages on your XWiki instance. However you can [[control this using a custom Export URL>>platform:Features.Exports||anchor="HXARExport"]].
Guillaume Lerouge 1.7 33
Vincent Massol 26.1 34 That said, it is also possible 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 for example. Here are the steps:
Dmitry Bakbardin 18.1 35
Guillaume Lerouge 1.8 36 * Unzip the file
37 * Keep the pages you want to put in your archive
Manuel Smeria 16.2 38 * Edit ##package.xml## to delete the pages you do not want to be in the archive
39 * 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
40 * You're done! You can now import this specific set of pages to any XWiki instance
Vincent Massol 1.9 41
Sorin Burjan 13.2 42 {{info}}
Vincent Massol 14.1 43 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 44 {{/info}}
Vincent Massol 26.1 45
Vincent Massol 26.2 46 = XAR Format =
Vincent Massol 26.1 47
Thomas Mortagne 28.1 48 See [[XAR Format specifications>>extensions:Extension.XAR Module Specifications]].

Get Connected