Last modified by Eleni Cojocariu on 2026/11/16 18:08

Show last authors
1 One row per legacy page of the tree, with what it was converted into. The numbers on [[Migration progress>>XWikiOrg.documentation-scripts-queries.migration-progress.WebHome]] are these same queries counted instead of listed.
2
3 {{cache timeToLive="3600" id="main-wiki-details-1-{{velocity}}#set($cacheKey = $stringtool.defaultString($request.get('audience')))#if($cacheKey.matches('^(user|admin|dev)$'))$cacheKey#end{{/velocity}}"}}
4 {{velocity}}
5 #*
6 Why this page is wrapped in a cache macro.
7
8 Every row here costs a lookup that the search index cannot do - the backlink count comes from the
9 link store, one call per page - so the cost of a view grows with the size of the tree being
10 listed. Measured as a guest before this cache was added: 1.7 s for the User guide, 2.3 s for the Admin one and 4 to 7.5 s for the Developer guide (316 pages). These are public pages, so
11 that was paid again on every visit, including every crawl.
12
13 Nothing about the queries changed; they now run at most once an hour per audience.
14
15 The id has to carry the audience, because the cached content is the same source text for all of
16 them: without an id, every audience would be served whichever one was computed first. It is
17 matched against the list of valid values rather than taken as given, so a crawler passing
18 ?audience=anything cannot mint a new cache entry - and a new computation - per request.
19
20 An id also means the page's own content is no longer part of the cache key, so editing anything
21 below does NOT invalidate what is already cached. Bump the number in the id when changing this
22 page, or the old output is what is served for the next hour - including a cached error block,
23 which is what a macro that fails in here leaves behind.
24 *#
25 #set ($audiences = [])
26 #set ($discard = $audiences.add({'key': 'user', 'label': 'User', 'tree': 'Documentation.UserGuide'}))
27 #set ($discard = $audiences.add({'key': 'admin', 'label': 'Admin', 'tree': 'Documentation.AdminGuide'}))
28 #set ($discard = $audiences.add({'key': 'dev', 'label': 'Developer', 'tree': 'Documentation.DevGuide'}))
29 ## 'audience' is what the switcher below is labelled and what the keys are named. 'tree' is the
30 ## parameter this page used until 2026-10-02, kept as a fallback so an old bookmark still opens the
31 ## guide it named instead of silently falling through to the default one.
32 #set ($requested = "$!request.get('audience')")
33 #if ($requested == '')
34 #set ($requested = "$!request.get('tree')")
35 #end
36 #set ($audience = '')
37 #foreach ($candidate in $audiences)
38 #if ($candidate.key == $requested)
39 #set ($audience = $candidate)
40 #end
41 #end
42 #if ($audience == '')
43 #set ($audience = $audiences.get(0))
44 #end
45 #set ($links = [])
46 #foreach ($candidate in $audiences)
47 #if ($candidate.key == $audience.key)
48 #set ($discard = $links.add("**$candidate.label**"))
49 #else
50 #set ($url = $doc.getURL('view', "audience=$candidate.key"))
51 #set ($discard = $links.add("[[$candidate.label>>path:$url]]"))
52 #end
53 #end
54 Audience: $stringtool.join($links, ' | ')
55
56 = $audience.label guide =
57
58 #set ($Q = '"')
59 #set ($mappingClass = 'XWikiOrg.documentation-scripts-queries.MigratedPageClass')
60 #set ($redirectClass = 'XWiki.RedirectClass')
61 #set ($base = "type:DOCUMENT AND wiki:xwiki AND hidden:false AND space_prefix:${Q}${audience.tree}${Q} AND -name:WebPreferences")
62 #set ($query = $services.query.createQuery($base, 'solr'))
63 #set ($discard = $query.setLimit(1000))
64 #set ($discard = $query.bindValue('sort', 'fullname asc'))
65 #set ($rows = $query.execute().get(0).results)
66 ## The same test as the Done column of the summary page, so the two can never disagree.
67 #set ($query = $services.query.createQuery("${base} AND property.XWiki.TagClass.tags:done", 'solr'))
68 #set ($discard = $query.setLimit(1000))
69 #set ($doneRefs = [])
70 #foreach ($row in $query.execute().get(0).results)
71 #set ($discard = $doneRefs.add($row.get('fullname')))
72 #end
73 ## Unconvertable pages are counted the same way, and by the same test as the summary page's column:
74 ## the page documents something deprecated, so it is leaving the tree without being converted.
75 #set ($query = $services.query.createQuery("${base} AND property.XWiki.TagClass.tags:unconvertable", 'solr'))
76 #set ($discard = $query.setLimit(1000))
77 #set ($unconvertableRefs = [])
78 #foreach ($row in $query.execute().get(0).results)
79 #set ($discard = $unconvertableRefs.add($row.get('fullname')))
80 #end
81 #set ($redirectCount = 0)
82 #set ($backlinkedCount = 0)
83 ## Distinct replacement pages of the whole tree: several legacy pages often converge on the
84 ## same new page, so this is a count of labels already seen, not a sum of the rows.
85 #set ($allTargets = [])
86 (% class="table" %)
87 |=Legacy page|=Done|=Unconvertable|=Converted into|=Redirects to|=Still has backlinks
88 #foreach ($row in $rows)
89 #set ($fullName = $row.get('fullname'))
90 #set ($title = "$!row.get('title_')")
91 #if ($title == '')
92 #set ($title = "$!row.get('name')")
93 #end
94 #set ($classes = $row.get('class'))
95 #set ($newPages = '')
96 #set ($redirect = '')
97 #if ($classes && ($classes.contains($mappingClass) || $classes.contains($redirectClass)))
98 #set ($legacyDoc = $xwiki.getDocument($fullName))
99 #set ($mapping = $legacyDoc.getObject($mappingClass))
100 #if ($mapping)
101 #set ($newPages = "$!mapping.getValue('newPages')")
102 #end
103 #set ($redirectObject = $legacyDoc.getObject($redirectClass))
104 #if ($redirectObject)
105 #set ($redirect = "$!redirectObject.getValue('location')")
106 #end
107 #end
108 #if ($doneRefs.contains($fullName))
109 #set ($doneCell = '✅')
110 #else
111 #set ($doneCell = '❌')
112 #end
113 #if ($unconvertableRefs.contains($fullName))
114 #set ($unconvertableCell = '✅')
115 #else
116 #set ($unconvertableCell = '❌')
117 #end
118 #set ($targets = [])
119 #set ($targetLabels = [])
120 #foreach ($line in $newPages.split('[\r\n]+'))
121 ## The field holds one wiki link per line, so that moving a replacement page rewrites it: the
122 ## rename job only follows links, and a bare reference it cannot see goes stale silently. Values
123 ## written before that change are still bare, hence unwrapping rather than parsing a link.
124 #set ($target = $line.trim().replaceAll('^\[\[', '').replaceAll('\]\]$', ''))
125 #set ($target = $target.replaceAll('\|\|.*$', '').replaceAll('^.*>>', ''))
126 #set ($target = $target.replaceAll('^doc:', '').trim())
127 #if ($target != '')
128 #set ($label = $target.replaceAll('^xwiki:', '').replaceAll('\.WebHome$', ''))
129 #set ($discard = $targetLabels.add($label))
130 #set ($discard = $targets.add("[[$label>>doc:$target]]"))
131 #if (!$allTargets.contains($label))
132 #set ($discard = $allTargets.add($label))
133 #end
134 #end
135 #end
136 ## A redirect names a replacement too, and it is the only one most legacy pages have: list it here
137 ## as well, unless the mapping object already records it.
138 #if ($redirect == '')
139 #set ($redirectCell = '—')
140 #else
141 #set ($redirectCount = $redirectCount + 1)
142 #set ($redirectLabel = $redirect.replaceAll('^xwiki:', '').replaceAll('\.WebHome$', ''))
143 #set ($redirectCell = "[[$redirectLabel>>doc:$redirect]]")
144 #if (!$targetLabels.contains($redirectLabel))
145 #set ($discard = $targets.add("[[$redirectLabel>>doc:$redirect]] //(redirect)//"))
146 #end
147 #if (!$allTargets.contains($redirectLabel))
148 #set ($discard = $allTargets.add($redirectLabel))
149 #end
150 #end
151 #if ($targets.isEmpty())
152 #set ($targetCell = '—')
153 #else
154 #set ($targetCell = $stringtool.join($targets, '\\'))
155 #end
156 ## What still points at the page, from the same index the Information tab reads -- and the same
157 ## answer: 63/63 and 48/48 on the two most linked pages, cross-wiki backlinks included (they are
158 ## a third of them here). It is also immune to the trailing-slash trap of that tab's URL, which
159 ## answers "no backlinks" for a terminal page. A page that already redirects needs no such check,
160 ## so it is not queried: this costs one lookup per remaining row, ~5 ms each.
161 #if ($redirect != '')
162 #set ($backlinkCell = '—')
163 #else
164 #set ($backlinks = $xwiki.getDocument($fullName).getBacklinks())
165 #if ($backlinks.isEmpty())
166 #set ($backlinkCell = '❌')
167 #else
168 #set ($backlinkedCount = $backlinkedCount + 1)
169 #set ($backlinkURL = $xwiki.getURL($fullName, 'view', 'viewer=information'))
170 #set ($backlinkCell = "[[✅ $backlinks.size()>>path:$backlinkURL]]")
171 #end
172 #end
173 |[[$title>>doc:$fullName]]|$doneCell|$unconvertableCell|$targetCell|$redirectCell|$backlinkCell
174 #end
175 |=**$rows.size() pages**|=**$doneRefs.size() done**|=**$unconvertableRefs.size() unconvertable**|=**$allTargets.size() new pages**|=**$redirectCount redirects**|=**$backlinkedCount still linked**
176 {{/velocity}}
177 {{/cache}}
178
179 A page counts as **done** when it carries the ##done## tag, and **unconvertable** when it carries the ##unconvertable## tag: that page documents something deprecated, so its content has no place in the new documentation and it will be neither converted nor mapped. Either tag takes the page out of the //Left// column of [[Migration progress>>XWikiOrg.documentation-scripts-queries.migration-progress.WebHome]]. //Converted into// is the ##newPages## field of its [[MigratedPageClass>>XWikiOrg.documentation-scripts-queries.MigratedPageClass]] object, so it stays empty until someone records where the content went. The field holds one wiki link per line: moving a replacement page rewrites that link like any other, so an entry follows its page instead of going stale. The total under //Converted into// counts the **distinct** replacement pages of the whole tree, so it is smaller than the sum of the rows whenever several legacy pages were merged into one new page. //Redirects to// is the ##location## of an ##XWiki.RedirectClass## object: such a page already sends its readers elsewhere, whether or not anyone marked it as done. //Still has backlinks// is the number of pages that link to this one, from the same index the page's own //Information// tab reads, so the two always agree - ✅ means there is still something to repoint, and the number links to the list. Pages that already redirect are not checked, since a redirect sends every one of those readers on; they show a dash. Backlinks from the other wikis of the farm are included, and they are a large share of them - of the 63 pointing at //Page Editing//, 9 come from extensions.xwiki.org, dev.xwiki.org and design.xwiki.org. What this index cannot see is a link written as an absolute URL (##~[~[...>>url:https:~/~/www.xwiki.org/...]]##); those need a separate search of the page content.

Get Connected