blob: d20a812968d23a11de66fddf2447f659a997d42e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
load 'mwapi.rb'
require 'yaml'
mw = MWApi.new('https://wiki.parabolagnulinux.org/api.php')
credentials = YAML.load_file('credentials.yml')
mw.login(credentials['username'], credentials['password'])
aufrom = ''
while not aufrom.nil? do
audata = mw.query(:list => :allusers, :aulimit => 200, :aufrom => aufrom, :auprop => 'blockinfo')
for user in audata['query']['allusers']
if user['blockid'].nil?
deleted_edits = 0 # XXX actually is the number of deleted pages edited, not number of edits
existing_edits = 0
drcontinue = ''
while not drcontinue.nil?
drdata = mw.query(:list => :deletedrevs, :druser => user['name'], :drlimit => 200)
deleted_edits += drdata['query']['deletedrevs'].length
drcontinue = nil
end
uccontinue = ''
while not uccontinue.nil?
ucdata = mw.query(:list => :usercontribs, :ucuser => user['name'], :uclimit => 200, :uccontinue => uccontinue)
existing_edits += ucdata['query']['usercontribs'].length
if ucdata['query-continue'].nil?
uccontinue = nil
else
uccontinue = ucdata['query-continue']['usercontribs']['uccontinue']
end
end
print "Username: #{user['name']}\tdeleted: #{deleted_edits}\texisting: #{existing_edits}\n"
else
print "Username: #{user['name']}\tblockreason: #{user['blockreason']}\n"
end
end
if audata['query-continue'].nil?
aufrom = nil
else
aufrom = audata['query-continue']['allusers']['aufrom']
end
end
|