Changes for page Cache

Last modified by Thomas Mortagne on 2018/05/30 10:38

From version 24.1
edited by Thomas Mortagne
on 2018/05/30 10:22
Change comment: There is no comment for this version
To version 25.1
edited by Thomas Mortagne
on 2018/05/30 10:28
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,36 +1,36 @@
1 -{{velocity}}
2 -#set($documentReference = 'FlamingoThemes.Iceberg')
1 +{{groovy}}
2 +var documentReference = 'FlamingoThemes.Iceberg'
3 3  
4 -#macro(documentInfos $document)
5 - isnew = $document.isNew()
6 - document title size: $document.title.length()
7 - document content size: $document.content.length()
4 +dev documentInfos(document) {
5 + println 'isnew' + document.isNew()
6 + println 'document title size:' + document.title.length()
7 + println 'document content size:' + document.content.length()
8 8  
9 - document objects:
10 - #foreach ($objectsEntry in $document.document.getXObjects().entrySet())
11 - * $objectsEntry.key#if($objectsEntry.value) $objectsEntry.size()#else null#end
12 - #end
9 + println 'document objects:'
10 + for (objectsEntry in document.document.getXObjects().entrySet()) {
11 + println '*' + objectsEntry.key + ($objectsEntry.value ? objectsEntry.value.size() : 'null')
12 + }
13 13  
14 - document attacments
15 - #foreach ($attachment in $document.getAttachmentList())
16 - * $attachment.filename
17 - #end
18 -#end
14 + println 'document attacments:'
15 + for (attachment in document.attachmentList) {
16 + println '*' + attachment.filename
17 + }
18 +}
19 19  
20 -#set($protectedXWiki = $xwiki.getXWiki())
21 -#set($cachedDocument = $protectedXWiki.getDocument($documentReference, $xcontext.context)))
20 +var protectedXWiki = xwiki.getXWiki()
21 +var cachedDocument = protectedXWiki.getDocument(documentReference, xcontext.context)))
22 22  
23 -= Cached document
23 +println '= Cached document'
24 24  
25 -#documentInfos($cachedDocument)
25 +documentInfos(cachedDocument)
26 26  
27 -= Original cached document
27 +println '= Original cached document'
28 28  
29 -#documentInfos($cachedDocument.originalDocument)
29 +documentInfos(cachedDocument.originalDocument)
30 30  
31 -= Database document
31 +println '= Database document'
32 32  
33 -#set($databaseDocument = $protectedXWiki.hibernateStore.loadXWikiDoc($cacheDocument.document, $xcontext.context))
33 +var databaseDocument = protectedXWiki.hibernateStore.loadXWikiDoc(new com.xpn.xwiki.doc.XWikiDocument(documentReference), xcontext.context)
34 34  
35 -#documentInfos($databaseDocument)
36 -{{/velocity}}
35 +documentInfos(databaseDocument)
36 +{{/groovy}}