15.082
Bearbeitungen
Keine Bearbeitungszusammenfassung |
K (Entfernte den Schutz von „Modul:Stadtwikis“) |
||
| (21 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt) | |||
| Zeile 2: | Zeile 2: | ||
local c = require( "Module:Common" ) | local c = require( "Module:Common" ) | ||
function getUrls() | |||
local urls = { | |||
function getUrls( | |||
urls = { | |||
"https://www.fuerthwiki.de/wiki/api.php", | "https://www.fuerthwiki.de/wiki/api.php", | ||
"https://oesterreichwiki.org/w/api.php", | "https://oesterreichwiki.org/w/api.php", | ||
| Zeile 19: | Zeile 17: | ||
"https://wiki.muenster.org/api.php", | "https://wiki.muenster.org/api.php", | ||
"https://www.tuepedia.de/api.php", | "https://www.tuepedia.de/api.php", | ||
"https://www.linzwiki.at/w/api.php" | -- "https://www.linzwiki.at/w/api.php" <= Fehlerteufel | ||
} | } | ||
-- Ausgefallene oder nicht vorhandene MediaWikis: | |||
-- "https://ka.stadtwiki.net/w/api.php", <= siteinfo down | -- "https://ka.stadtwiki.net/w/api.php", <= siteinfo down | ||
-- "https://www.aw-wiki.de/w/api.php", <= siteinfo down | -- "https://www.aw-wiki.de/w/api.php", <= siteinfo down | ||
-- "https://www.stadtwikidd.de/wiki/api.php" <= too old version, no api | -- "https://www.stadtwikidd.de/wiki/api.php" <= too old version, no api | ||
-- "https://wuerzburgwiki.de/w/api.php", | -- "https://wuerzburgwiki.de/w/api.php", | ||
return urls | |||
end | end | ||
function p.Versuch(frame) | function p.Versuch(frame) | ||
local urls = getUrls() | local urls = getUrls() | ||
local results = {} | local results = {} | ||
local stat, info | |||
for i = 1, #urls do | for i = 1, #urls do | ||
local data_stat = mw.ext.externalData.getWebData{ url = urls[i].. | local data_stat = mw.ext.externalData.getWebData{ | ||
local data_info = mw.ext.externalData.getWebData{ url = urls[i].. | url = urls[i].."?action=query&meta=siteinfo&siprop=statistics&format=json", | ||
format = "json"} | |||
local data_info = mw.ext.externalData.getWebData{ | |||
url = urls[i].."?action=query&meta=siteinfo&format=json", | |||
format = "json"} | |||
results[i] = { | results[i] = { | ||
| Zeile 63: | Zeile 45: | ||
} | } | ||
end | end | ||
local h='<table class="wikitable sortable"><tr>'.. | |||
'<th>Wiki URL</th>'.. | |||
'<th>Artikel</th>'.. | |||
'<th>Bilder</th>'.. | |||
'<th>Bearbeitungen</th>'.. | |||
'<th>Benutzer</th>'.. | |||
'<th>Aktive</th>'.. | |||
'<th>Admins</th>'.. | |||
'</tr>' | |||
for i = 1, #urls do | |||
h=h..tabelizeData(urls[i], results[i].stat, results[i].info) | |||
mw.log(mw.dumpObject(results[i].info)) | |||
for i, | |||
end | end | ||
h=h.."<table>" | |||
return h | |||
h=h.. | |||
end | end | ||
function tabelizeData(url, | function tabelizeData(url, s, i) | ||
h='<tr>'.. | h='<tr>'.. | ||
'<td>'.. | '<td>'..i['sitename']..'</br>'..i['base']..'</td>'.. | ||
'<td>'.. | '<td>'..s['articles']..'</td>'.. | ||
'<td>'.. | '<td>'..s['images']..'</td>'.. | ||
'<td>'.. | '<td>'..s['edits']..'</td>'.. | ||
'<td>'.. | '<td>'..s['users']..'</td>'.. | ||
'<td>'.. | '<td>'..s['activeusers']..'</td>'.. | ||
'<td>'.. | '<td>'..s['admins']..'</td>'.. | ||
'</tr>' | '</tr>' | ||
return h | return h | ||
end | end | ||
return p | return p | ||