Исходный код вики Show Spammed Pages
Редактировал(а) Dmitriy Rybakov 05.08.2025, 13:07
Последние авторы
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{velocity}} | ||
| 2 | |||
| 3 | #set($threshold='50') | ||
| 4 | |||
| 5 | {{info}} Actual spam threshold is set to $threshold {{/info}} | ||
| 6 | #if($hasProgramming) | ||
| 7 | #set($sqlTools = $xwiki.parseGroovyFromPage('Admin.SQLToolsGroovy')) | ||
| 8 | #set($system = $sqlTools.getXWikiDatabaseSystemFromDatabaseMetadata($xcontext)) | ||
| 9 | Your database is: **$system** | ||
| 10 | #if($system == "HSQL Database Engine") | ||
| 11 | {{warning}}$system is not supported for this action{{/warning}} | ||
| 12 | #end | ||
| 13 | |||
| 14 | #set($query = "select count(XWO_NAME) as Comments,XWO_NAME as doc from xwikiobjects where XWO_CLASSNAME='XWiki.XWikiComments' GROUP BY XWO_NAME HAVING Comments >= ${threshold};") | ||
| 15 | #set($connection = $sqlTools.getXWikiConnection($xwiki, $xcontext)) | ||
| 16 | #set($results = $sqlTools.getResults($connection, $query, false)) | ||
| 17 | #if($results.split('\n').size() > 1) | ||
| 18 | = Spammed pages of wiki $xcontext.getDatabase() = | ||
| 19 | $results | ||
| 20 | #else | ||
| 21 | {{success}}No spam in this wiki!{{/success}} | ||
| 22 | #end | ||
| 23 | #else | ||
| 24 | {{error}}Sorry, you need the programming rights to use this tool{{/error}} | ||
| 25 | #end | ||
| 26 | {{/velocity}} |