Wiki source code of Stats per date

Last modified by Vincent Massol on 2014/07/22 11:09

Hide last authors
Vincent Massol 1.1 1 Shows how many extensions have been created between 2 dates.
2
Vincent Massol 14.1 3 Supported parameters:
4 * Use ##confirm=1## to execute.
5 * Pass ##start## and ##end## parameters to specify the dates.
Vincent Massol 17.2 6 * Pass ##nocommitters=1## to exclude extensions created by the XWiki Dev Team
Vincent Massol 3.1 7
Vincent Massol 17.1 8 For example: ##confirm=1&start=2013-06-30&end=2014-06-30&nocommitters=1##.
Vincent Massol 4.1 9
Vincent Massol 1.1 10 {{groovy}}
11 if (request.confirm == '1') {
Vincent Massol 3.1 12 def total = 0
Vincent Massol 16.1 13 def xwql = "from doc.object(ExtensionCode.ExtensionClass) as extension where doc.space = 'Extension' and doc.creationDate >= :start and doc.creationDate < :end"
Vincent Massol 15.1 14 if (request.nocommitters == '1') {
Vincent Massol 16.1 15 xwql = "${xwql} and extension.authors not in ('xwiki:XWiki.XWikiTeam')"
Vincent Massol 14.1 16 }
17 services.query.xwql(xwql).bindValue('start', Date.parse('yyyy-MM-dd', request.start)).bindValue('end', Date.parse('yyyy-MM-dd', request.end)).execute().each() {
Vincent Massol 10.1 18 println "* ${it}"
Vincent Massol 3.1 19 total++
Vincent Massol 1.1 20 }
Vincent Massol 3.1 21 println ""
22 println "total: ${total}"
Vincent Massol 1.1 23 }
24 {{/groovy}}

Get Connected