Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{groovy}} | ||
2 | import java.text.SimpleDateFormat | ||
3 | |||
4 | def results = [] | ||
5 | def dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") | ||
6 | def cutoff = new Date(System.currentTimeMillis() - (1000L * 60 * 60 * 48)) // 48 hours ago | ||
7 | |||
8 | xwiki.searchDocuments("where 1=1").each { docName -> | ||
9 | def doc = xwiki.getDocument(docName) | ||
10 | def lastMod = doc.getDate() | ||
11 | |||
12 | if (lastMod && lastMod.after(cutoff)) { | ||
13 | results << "* [[${doc.displayTitle}>>path:/bin/view/${doc.space}/${doc.name}]] — last edited by **${doc.author}** at ${dateFormat.format(lastMod)}" | ||
14 | } | ||
15 | } | ||
16 | |||
17 | if (results) { | ||
18 | println "== 🕒 Pages Edited in the Last 48 Hours ==" | ||
19 | results.each { println it } | ||
20 | } else { | ||
21 | println "✅ No pages were edited in the last 48 hours." | ||
22 | } | ||
23 | {{/groovy}} |