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.
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.
Ludovic
Artem Melentyev a écrit :
Hi.
Ludovic Dubost wrote:
But what for the latest version of the document..
It could still be
wrong compared to the last RCS version
It will be sync on next save.
I think this is not too important.
IMHO any bug-specific migrations(as XWIKI-1468-B) in
xwiki-platform-core is bad. Because:
it is decrease performance
fast to obsolete
pollution core code
If we really need migration maybe we need create migration system.
Something like: store data version in db, xwiki will execute
migrations at boot. Migrations will be like patches from one data
version to another.
(XWIKI-883 also need migration)
WDYT?
Artem Melentyev a écrit :
> Hi.
>
> I'm sorry for hasn't replied early. I had problems with spam filters
> :/.
>
> I fix this problem in XWIKI-1459 in >=XWIKI-1459-2-r2.patch.zip
> (18.07) yet.
>
> My implementation:
> Before I save document, I do
> document.setVersion(~archive.getLatestVersion()+1)
> After I load a specific version of document, I do
> doc.setVersion(thisversion)
>
> So document.version is fully depends on rcs store. We don't need to
> store version in xml.
> No need for special migration.
> Version numbers may be any.
>
> Ludovic Dubost wrote:
>> Erin Schnabel a écrit :
>>
>> [snip]
>>> I prefer to allow document versions to start at an arbitrary number
>>> (i.e. if I've imported the document from another wiki, I like to
>>> preserve the version of the document from the original wiki in the
>>> target wiki). This means that the first version of the document
>>> may be
>>> 1.9, and that's certainly a lot more than one version off...
>>>
>> That's indeed possible to do. The versions don't need to be off
>> though.. The document version will match the version in RCS.
>> It's not a problem to have versions start at a certain number. This
>> happens if the resetVersion API is called.
>>
>> The problem is different than this out of sync issue between RCS
>> and the current document version. Here our problem is that the RCS
>> version does not match what you have in the archived XML document..
>>
>> I've made progress with my fix. You can check out a fix in
>>
http://jira.xwiki.org/jira/browse/XWIKI-1468
>>
>> Now for your suggestion of having imports not resetting version, I
>> think both cases are interesting. Sometimes we want to reset (like
>> when importing a default wiki).
>> There will need to be an option to decide if you want to reset
>> version numbers or not.