Details
-
Bug
-
Resolution: Fixed
-
Critical
-
13.4.3
-
Unit
-
Unknown
-
N/A
-
N/A
-
Description
I am using the XWikiDocument#copyDocument(DocumentReference newDocumentReference, XWikiContext context) API in a groovy script in order to copy a document to a new location.
The copy is working but I have this warning on the logs :
Space [Space ***] does not exist. Usually means the spaces table is not in sync with the documents table.
I checked the xwikispace table and I find that the new space is not created.
Follow these steps to reproduce :
- XWiki 13.4.3
- Create a test page : Sandbox.MyTestPage.WebHome
- Create a script page (Sandbox.CopyPageScript) that will be used to copy the page created above to this location Sandbox.MyNewTestPage.WebHome, copy the following script on its content, save and view the page
{{groovy}} def sourceDoc = xwiki.getDocument('Sandbox.MyTestPage.WebHome').getDocument() def targetDocumentReference = services.model.createDocumentReference('', ['Sandbox', 'MyNewTestPage'], 'WebHome') def targetDoc = sourceDoc.copyDocument(targetDocumentReference, xcontext.getContext()) xcontext.getXWiki().saveDocument(targetDoc, "", xcontext.context) {{/groovy}}
Expected results : the page is copied to 'Sandbox.MyNewTestPage.WebHome' without any warning and the new page space is added to the xwikispace table
Current result : the page is copied but the space of the new page is not added to the xwikispace table.
the sql query select * from xwikispace where XWS_REFERENCE like 'Sandbox.MyNewTestPage'; return 0 results.