Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
2.0 M4
-
None
-
patch
-
Unknown
-
Awaiting Committer feedback
-
Description
to repeat:
create a document and call it anything except newDoc.
In it put this:
These two GUIDs should be the same {{groovy}} def oldName = doc.getName() def obj = doc.getObject("TagClass"); println(obj.getGuid().toString()); doc.rename("newName"); def newObj = doc.getObject("TagClass"); println(newObj.getGuid().toString()); doc.rename(oldName); {{/groovy}}
Solving this is more complex than it first appears.
XWikiDocument.rename calls XWiki.copyDocument and XWiki.copyDocument calls XWikiDocument.copyDocument and then calls XWiki.saveDocument.
By the time XWikiDocument.rename gets the copy back, it is already saved. If we are to fix the objects after the copy event, rename will then need to save the document (and all translated versions) twice, otherwise we could add another boolean variable to XWiki.copyDocument which decides should it change GUIDs and thus the problem is solved before saveDocument is called.
Attachments
Issue Links
- depends on
-
XWIKI-13935 Add atomic store API for document renames
- Closed
- is related to
-
XWIKI-4326 When given a name of a target document which already exists, XWikiDocument.rename refactors links and deletes original
- Open
-
XWIKI-9425 Renaming a page changes the creation date
- Closed