|
Description: |
How to reproduce: * create a xar extension in which a page marked as a translation contains an object in the xml export of the page * install the extension
Expected result: * no object is created in the database, as objects cannot be attached associated to translated pages , only to the original page
Actual result: * an object is created in the database along with the translation page.
Now, having an object in the xml in the translated pages is not "correct" but there is nothing to validate it in the xar:format and, as this issue proves, nothing to stop it from being imported if present.
The use case described in this issue is rather simple and harmless, but when the extension is more complex, there are some undesired side effects of the fact that the xar handler is handling objects and attachments in translated pages, as if they were legitimate.
A good example is for the PublicationWorkflow contrib extension: * it has a translations page, Translations, which has an original document and 2 translations (fr and de) * in version 1.9.1.1, the 2 translations contained the XWiki.TranslationDocumentClass object, by mistake, as well as the original document did * in the latest version (2.3.2), these 2 objects were removed * when 1.9.1.1 is installed, the 3 objects from the 3 pages (original + translations) are handled, but there is no bad effect as the object is exactly the same and it overrides itself , so the endresult is a single object in the database, which is what we expect * upon upgrade to 2.3.2, if the translation pages are imported first by the extension manager, the following happens upon a translation page import: ** extension manager loads previous version and finds it with an object inside - because it had one in the xar ** then, it loads the next version and finds it without an object inside - because it doesn't have one anymore (it was fixed) ** it compares the 2 and finds that an object was removed. Thus, it schedules the object for removal from storage. This removal removes the actual object from the original document, as per the current issue (objects are handled on translations as if they were on the original document) * then, when the original document is processed by EM, the situation is as follows: ** previous document has an object inside ** next document has an object inside ** however, current document from the wiki does not have an object inside anymore (it was removed upon translations processing) ** EM makes a merge and keeps the object deleted. * thus, the result here is that the object ends up being deleted upon upgrade of the extension.
|
|