Hi.
Ludovic Dubost wrote:
I have some Diff code that requires the data to be correct in the Database.
I agree that code polution is not great. So I suggest we write some code
to "fix and resave" without changing the document version number.
For this we need a "resave" api that does not change anything in the
document.
Do you mean we need reconstruct only XWikiDocumentArchive without to set
XWikiDocument.version?
What I don't like too much in Artem's proposed
approach is the the
version inside the XML is different than the version in the RCS file.
I think it is still better to have them in sync.
I propose to modify my fix patch but not to run it dynamically, but only
from an API in groovy and provide a groovy script to fix versions.
We'll explain in the release notes that this scripts needs to be called
for versioning to have the expected behavior.
This is good solution.
But we have another major problem with versions: XWIKI-1582.
While xwiki is importing, packager plugin do not reset doc.version when
history is not in xar. So we get doc.version>1.1 and
archive.latestVersion=1.1. This bug is old. Catalin reproduces it on
xwiki-1.1M1.
There are many problems because we assume that archive is always begins
at 1.1 in many places of core. All these problems can't be fixed for
1.1M4, so I think we need to set document.version to
archive.latestVersion for sync versions.
Ludovic: your patch is simple make -1 to all versions. This is not adapt
to migration for XWIKI-1582. We need more. We need reconstruct history
from scratch and set doc.versions according to document archive.
I attached XWIKI-1468-resaveapi-amelentev.patch and fixrcs.groovy as sample.
But these patches modify document.version and save document as new
version with comment "fixrcs".
WDYT?
--
Artem Melentyev