Wiki source code of Migration from 1.x
Last modified by Vincent Massol on 2021/04/06
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | {{velocity}} |
2 | ## Find all pages having a v1.x ReleaseNotes.Code.ChangesClass | ||
3 | #set ($topSpace = $doc.documentReference.extractFirstReference('SPACE').getName()) | ||
4 | #set ($xwql = "from doc.object(${topSpace}.Code.ChangesClass) as changes") | ||
5 | #if ($request.confirm != '1') | ||
6 | The following pages need to be migrated: | ||
7 | #else | ||
8 | The following pages have been migrated: | ||
9 | #end | ||
10 | #foreach ($item in $services.query.xwql($xwql).execute()) | ||
11 | #if ($request.confirm == '1') | ||
12 | #set ($itemDoc = $xwiki.getDocument($item)) | ||
13 | ## Add a ReleaseNotes.Code.EntryClass | ||
14 | #set ($newEntryObject = $itemDoc.newObject("${topSpace}.Code.EntryClass")) | ||
15 | ## Add a ReleaseNotes.Code.Change.ChangeClass | ||
16 | #set ($newChangeObject = $itemDoc.newObject("${topSpace}.Code.Change.ChangeClass")) | ||
17 | ## Copy data from ReleaseNotes.Code.ChangesClass into the 2 new objects | ||
18 | #set ($oldChangeObject = $itemDoc.getObject("${topSpace}.Code.ChangesClass")) | ||
19 | #set ($discard = $newEntryObject.set('version', $oldChangeObject.getValue('version'))) | ||
20 | #set ($discard = $newEntryObject.set('product', $oldChangeObject.getValue('product'))) | ||
21 | #set ($discard = $newEntryObject.set('type', 'Change')) | ||
22 | #set ($discard = $newChangeObject.set('summary', $oldChangeObject.getValue('summary'))) | ||
23 | #set ($discard = $newChangeObject.set('audience', $oldChangeObject.getValue('audience'))) | ||
24 | #set ($discard = $newChangeObject.set('importance', $oldChangeObject.getValue('importance'))) | ||
25 | #set ($discard = $newChangeObject.set('description', $oldChangeObject.getValue('description'))) | ||
26 | #set ($discard = $newChangeObject.set('category', $oldChangeObject.getValue('category'))) | ||
27 | #set ($discard = $newChangeObject.set('title', $oldChangeObject.getValue('title'))) | ||
28 | #set ($discard = $newChangeObject.set('screenshots', $oldChangeObject.getValue('screenshots'))) | ||
29 | ## Remove the old ReleaseNotes.Code.ChangesClass xobject | ||
30 | #set ($discard = $itemDoc.removeObject($oldChangeObject)) | ||
31 | ## Save the changes | ||
32 | #set ($discard = $itemDoc.save('Migrated from v1.x format to v2.0', true)) | ||
33 | * [[$item>>$item]] | ||
34 | #else | ||
35 | * [[$item>>$item]] | ||
36 | #end | ||
37 | #end | ||
38 | |||
39 | #if ($request.confirm != '1') | ||
40 | [[Start Migration>>||queryString='confirm=1']] | ||
41 | #end | ||
42 | {{/velocity}} |