Details
-
Bug
-
Resolution: Fixed
-
Major
-
9.8.1
-
Unknown
-
N/A
-
N/A
-
Description
XWiki version : 9.8.1
To reproduce :
- On a multilingual XWiki instance create a test page with the default language as original language.
- Translate the page to another language (ex : FR)
- Export the pages in a xar with the history included (you could use the Admin Tools Application to do the export), here is the xar file I have used during my tests : Articles.004888.2023-06-23.WebHome.xar .
- Using the Import a XAR in a wiki REST Service in order to import the pages on another xwiki instance as a backup and replace the existing history of the pages with the history the pages from the xar package. The Rest service parameters should initialised like this : backup=true&history=REPLACE, use this Curl command to import the xar :
curl -u "username:password" -X POST "http://localhost:8080/xwiki/rest/wikis/xwiki?backup=true&history=REPLACE" --data-binary "@/Path/to/the/xar/file" -H "Content-type:application/octet-stream"
- Once the import done, check the history of the imported pages
Expected results :
The pages are correctly imported and the history of the pages is exactly the same as the history of the exported pages (from the xar package)
Current results:
- The history of the translation page (FR) is ok, it is exactly the same as the history of the exported page
- The history of the default page is not as expected, it is not exactly the same as the history of the exported page, what happen is that an additional entry is added on the default page history, the entry corresponds to the import action entry ("Imported from XAR"), note that the additional entry do not brigs any changes on the document. See screenshot :
I imported the same page using the standard import xar feature on the wiki administration with these options selected : "Replace the page history with the history from the package" and "Import as backup package", see screenshot :
The import via the wiki administration worked as expected the history of the page was imported without any additional entry, see screenshot :
I investigated the issue and I found that the "Import a XAR in a wiki" REST API and the standard XAR import feature are not using the same system, by default the standard import feature is using the new "Filter module" system in order to do the import (see code here) while the REST service is always using the old import system (package plugin), (see code here).
Note that the default option can be modified to use the old system (package plugin) by setting the "xwiki.action.import.xar.usefilter" to "0" on WEB-INF/xwiki.cfg file.
In order to confirm that the issue is coming from the old xar import system I changed the "xwiki.action.import.xar.usefilter" configuration on the xwiki.cfg file to use the old system and re-imported the xar via the wiki administration, the results are the same when using the REST service API, there an additional entry on the default translation of the page. Based on that we can say that there is probably a bug on the old XAR importer plugin.
Note that on the recent versions of XWiki the old xar import plugin is no more used, only the "Filter Module is supported" (see code here), so, the "Import a XAR in a wiki" REST Service should be fixed in order to use the "Filter Module".