mediawiki-butt 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mediawiki/administration.rb +4 -2
- data/lib/mediawiki/butt.rb +8 -11
- data/lib/mediawiki/constants.rb +213 -215
- data/lib/mediawiki/edit.rb +7 -4
- data/lib/mediawiki/query/lists.rb +192 -101
- data/lib/mediawiki/query/meta/userinfo.rb +13 -9
- data/lib/mediawiki/query/properties/contributors.rb +70 -0
- data/lib/mediawiki/query/properties/files.rb +95 -0
- data/lib/mediawiki/query/properties/pages.rb +445 -0
- data/lib/mediawiki/query/properties/properties.rb +45 -0
- data/lib/mediawiki/query/query.rb +27 -1
- metadata +9 -20
- data/CHANGELOG.md +0 -119
- data/lib/mediawiki/query/properties.rb +0 -107
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f09a41fd00c3ff2e7f5bc1cafa03ed5d950b5cc
|
4
|
+
data.tar.gz: 60402f6721be863aeb428c13933cfdcc5e9214ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4023e04f09486f94ad4b6af55d889e6b5aa39af713842c5b1574ddd2c0929d847c0d2581e2e6933676b9fb3877d3e0b577fa19ce11e4cbfa2d2b85b2b79252d
|
7
|
+
data.tar.gz: deea5c87cdf91d334f97e62f6c065ae6f71fed9ca9ac1ae56a512c17ebbfb207eaab7fd6f80ff032cc7bd5f900f90e832bab5534b23ca7822c9542239f79afd2
|
@@ -5,7 +5,8 @@ module MediaWiki
|
|
5
5
|
# @param expiry [String] The expiry timestamp using a relative expiry time.
|
6
6
|
# @param reason [String] The reason to show in the block log.
|
7
7
|
# @param nocreate [Boolean] Whether to allow them to create an account.
|
8
|
-
# @return [String
|
8
|
+
# @return [String] The error code.
|
9
|
+
# @return [Int] The block ID.
|
9
10
|
def block(user, expiry = '2 weeks', reason = nil, nocreate = true)
|
10
11
|
params = {
|
11
12
|
action: 'block',
|
@@ -30,7 +31,8 @@ module MediaWiki
|
|
30
31
|
# Unblocks the user.
|
31
32
|
# @param user [String] The user to unblock.
|
32
33
|
# @param reason [String] The reason to show in the block log.
|
33
|
-
# @return [String
|
34
|
+
# @return [String] The error code.
|
35
|
+
# @return [Int] The block ID.
|
34
36
|
def unblock(user, reason = nil)
|
35
37
|
params = {
|
36
38
|
action: 'unblock',
|
data/lib/mediawiki/butt.rb
CHANGED
@@ -14,7 +14,7 @@ module MediaWiki
|
|
14
14
|
include MediaWiki::Query::Meta::UserInfo
|
15
15
|
include MediaWiki::Query::Properties
|
16
16
|
include MediaWiki::Query::Lists
|
17
|
-
include MediaWiki::Constants
|
17
|
+
include MediaWiki::Constants
|
18
18
|
include MediaWiki::Edit
|
19
19
|
include MediaWiki::Administration
|
20
20
|
|
@@ -23,14 +23,14 @@ module MediaWiki
|
|
23
23
|
# @param url [String] The FULL wiki URL. api.php can be omitted, but it
|
24
24
|
# will make harsh assumptions about your wiki configuration.
|
25
25
|
# @param use_ssl [Boolean] Whether or not to use SSL. Will default to true.
|
26
|
-
# @
|
27
|
-
def initialize(url, use_ssl = true)
|
26
|
+
# @param custom_agent [String] A custom User-Agent to use. Optional.
|
27
|
+
def initialize(url, use_ssl = true, custom_agent = nil)
|
28
28
|
@url = url =~ /api.php$/ ? url : "#{url}/api.php"
|
29
|
-
|
30
29
|
@client = HTTPClient.new
|
31
30
|
@uri = URI.parse(@url)
|
32
31
|
@ssl = use_ssl
|
33
32
|
@logged_in = false
|
33
|
+
@custom_agent = custom_agent unless custom_agent.nil?
|
34
34
|
@tokens = {}
|
35
35
|
end
|
36
36
|
|
@@ -42,8 +42,8 @@ module MediaWiki
|
|
42
42
|
# @param autoparse [Boolean] Whether or not to provide a parsed version
|
43
43
|
# of the response's JSON. Will default to true.
|
44
44
|
# @param header [Hash] The header hash. Optional.
|
45
|
-
# @return [JSON/HTTPMessage] Parsed JSON if autoparse is true
|
46
|
-
#
|
45
|
+
# @return [JSON/HTTPMessage] Parsed JSON if autoparse is true.
|
46
|
+
# @return [HTTPMessage] Raw HTTP response.
|
47
47
|
def post(params, autoparse = true, header = nil)
|
48
48
|
# Note that defining the header argument as a splat argument (*header)
|
49
49
|
# causes errors in HTTPClient. We must use header.nil? rather than a
|
@@ -56,11 +56,8 @@ module MediaWiki
|
|
56
56
|
params[:format] = 'json'
|
57
57
|
header = {} if header.nil?
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
else
|
62
|
-
header['User-Agent'] = "#{@name}/MediaWiki::Butt"
|
63
|
-
end
|
59
|
+
header['User-Agent'] = @logged_in ? "#{@name}/MediaWiki::Butt" : 'NotLoggedIn/MediaWiki::Butt'
|
60
|
+
header['User-Agent'] = @custom_agent if defined? @custom_agent
|
64
61
|
|
65
62
|
res = @client.post(@uri, params, header)
|
66
63
|
|
data/lib/mediawiki/constants.rb
CHANGED
@@ -1,219 +1,217 @@
|
|
1
1
|
module MediaWiki
|
2
2
|
module Constants
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
}
|
217
|
-
end
|
3
|
+
# Taken from https://www.mediawiki.org/wiki/Extension_default_namespaces
|
4
|
+
NAMESPACES = {
|
5
|
+
'MAIN' => 0,
|
6
|
+
'TALK' => 1,
|
7
|
+
'USER' => 2,
|
8
|
+
'USER_TALK' => 3,
|
9
|
+
'PROJECT' => 4,
|
10
|
+
'PROJECT_TALK' => 5,
|
11
|
+
'FILE' => 6,
|
12
|
+
'FILE_TALK' => 7,
|
13
|
+
'MEDIAWIKI' => 8,
|
14
|
+
'MEDIAWIKI_TALK' => 9,
|
15
|
+
'TEMPLATE' => 10,
|
16
|
+
'TEMPLATE_TALK' => 11,
|
17
|
+
'HELP' => 12,
|
18
|
+
'HELP_TALK' => 13,
|
19
|
+
'CATEGORY' => 14,
|
20
|
+
'CATEGORY_TALK' => 15,
|
21
|
+
'SPECIAL' => -1,
|
22
|
+
'MEDIA' => -2,
|
23
|
+
|
24
|
+
# Extension:LiquidThreads
|
25
|
+
'LQT_THREAD' => 90,
|
26
|
+
'LQT_THREAD_TALK' => 91,
|
27
|
+
'LQT_SUMMARY' => 92,
|
28
|
+
'LQT_SUMMARY_TALK' => 93,
|
29
|
+
|
30
|
+
# Extension:Semantic MediaWiki / Extension:Semantic Forms
|
31
|
+
'SMW_RELATION' => 100,
|
32
|
+
'SMW_RELATION_TALK' => 101,
|
33
|
+
'SMW_PROPERTY' => 102,
|
34
|
+
'SMW_PROPERTY_TALK' => 103,
|
35
|
+
'SMW_TYPE' => 104,
|
36
|
+
'SMW_TYPE_TALK' => 105,
|
37
|
+
'SMW_FORM' => 106,
|
38
|
+
'SMW_FORM_TALK' => 107,
|
39
|
+
'SF_CONCEPT' => 108,
|
40
|
+
'SF_CONCEPT_TALK' => 109,
|
41
|
+
|
42
|
+
# Extension:DPLforum
|
43
|
+
'DPLF_FORUM' => 110,
|
44
|
+
'DPLF_FORUM_TAlK' => 111,
|
45
|
+
|
46
|
+
# Extension:RefHelper
|
47
|
+
'RFH_CITE' => 120,
|
48
|
+
'RFH_CITE_TALK' => 121,
|
49
|
+
|
50
|
+
# Extension:SemanticAccessControl
|
51
|
+
'ACL_USERGROUP' => 160,
|
52
|
+
'ACL_ACL' => 162,
|
53
|
+
|
54
|
+
# Extension:Semantic Drilldown
|
55
|
+
'SED_FILTER' => 170,
|
56
|
+
'SED_FILTER_TALK' => 171,
|
57
|
+
|
58
|
+
# Extension:SocialProfile
|
59
|
+
'SCP_USERWIKI' => 200,
|
60
|
+
'SCP_USERWIKI_TALK' => 201,
|
61
|
+
'SCP_USERPROFILE' => 202,
|
62
|
+
'SCP_USERPROFILE_TALK' => 203,
|
63
|
+
|
64
|
+
# Extension:Proofread Page
|
65
|
+
'PRP_PAGE' => 250,
|
66
|
+
'PRP_PAGE_TALK' => 251,
|
67
|
+
'PRP_INDEX' => 252,
|
68
|
+
'PRP_INDEX_TALK' => 253,
|
69
|
+
|
70
|
+
# Extension:TrustedMath
|
71
|
+
'TRM_MATH' => 262,
|
72
|
+
'TRM_MATH_TALK' => 263,
|
73
|
+
|
74
|
+
# Extension:Widgets
|
75
|
+
'WID_WIDGET' => 274,
|
76
|
+
'WID_WIDGET_TALK' => 275,
|
77
|
+
|
78
|
+
# Extension:EmbedScript
|
79
|
+
'EMS_JSAPPLET' => 280,
|
80
|
+
'EMS_JSAPPLET_TALK' => 281,
|
81
|
+
|
82
|
+
# Extension:PollNY
|
83
|
+
'PLN_POLL' => 300,
|
84
|
+
'PLN_POLL_TALK' => 301,
|
85
|
+
|
86
|
+
# Extension:Semantic Image Annotator
|
87
|
+
'SIA_IMAGE_ANNOTATOR' => 380,
|
88
|
+
|
89
|
+
# Extension:Wiki2LaTeX
|
90
|
+
'WTL_WIKI2LATEX' => 400,
|
91
|
+
'WTL_WIKI2LATEX_TALK' => 401,
|
92
|
+
|
93
|
+
# Extension:Workflow
|
94
|
+
'WRF_WORKFLOW' => 410,
|
95
|
+
'WRF_WORKFLOW_TALK' => 411,
|
96
|
+
|
97
|
+
# Extension:Maps
|
98
|
+
'MAP_LAYER' => 420,
|
99
|
+
'MAP_LAYER_TALK' => 421,
|
100
|
+
|
101
|
+
# Extension:QuizTabulate
|
102
|
+
'QTB_QUIZ' => 430,
|
103
|
+
'QTB_QUIZ_TALK' => 431,
|
104
|
+
|
105
|
+
# Extension:Education Program
|
106
|
+
'EDP_EDUCATION_PROGRAM' => 446,
|
107
|
+
'EDP_EDUCATION_PROGRAM_TALK' => 447,
|
108
|
+
|
109
|
+
# Extension:BoilerRoom
|
110
|
+
'BLR_BOILERPLATE' => 450,
|
111
|
+
'BLR_BOILERPLATE_TALK' => 451,
|
112
|
+
|
113
|
+
# Extension:UploadWizard
|
114
|
+
'UPW_CAMPAIGN' => 460,
|
115
|
+
'UPW_CAMPAIGN_TALK' => 461,
|
116
|
+
|
117
|
+
# Extension:EventLogging
|
118
|
+
'ELG_SCHEMA' => 470,
|
119
|
+
'ELG_SCHEMA_TALK' => 471,
|
120
|
+
|
121
|
+
# Extension:ZeroBanner
|
122
|
+
'ZRB_ZERO' => 480,
|
123
|
+
'ZRB_ZERO_TALK' => 481,
|
124
|
+
|
125
|
+
# Extension:JsonConfig
|
126
|
+
'JSC_CONFIG' => 482,
|
127
|
+
'JSC_CONFIG_TALK' => 483,
|
128
|
+
'JSC_DATA' => 486,
|
129
|
+
'JSC_DATA_TALK' => 487,
|
130
|
+
|
131
|
+
# Extension:Graph
|
132
|
+
'GRP_GRAPH' => 484,
|
133
|
+
'GRP_GRAPH_TALK' => 485,
|
134
|
+
|
135
|
+
# Extension:OpenStackManager
|
136
|
+
'OSM_NOVA_RESOURCE' => 488,
|
137
|
+
'OSM_NOVA_RESOURCE_TALK' => 489,
|
138
|
+
|
139
|
+
# Extension:GWToolset
|
140
|
+
'GWT_GWTOOLSET' => 490,
|
141
|
+
'GWT_GWTOOLSET_TALK' => 491,
|
142
|
+
|
143
|
+
# Extension:BlogPage
|
144
|
+
'BLP_BLOG' => 500,
|
145
|
+
'BLP_BLOG_TALK' => 501,
|
146
|
+
|
147
|
+
# Extension:XMLContentExtension
|
148
|
+
'XCE_XML' => 580,
|
149
|
+
'XCE_XML_TALK' => 581,
|
150
|
+
'XCE_SCHEMA' => 582,
|
151
|
+
'XCE_SCHEMA_TALK' => 583,
|
152
|
+
|
153
|
+
# Extension:FanBoxes
|
154
|
+
'FNB_USERBOX' => 600,
|
155
|
+
'FNB_USERBOX_TALK' => 601,
|
156
|
+
|
157
|
+
# Extension:LinkFilter
|
158
|
+
'LFT_LINK' => 700,
|
159
|
+
'LFT_LINK_TALK' => 701,
|
160
|
+
|
161
|
+
# Extension:TimedMediaHandler
|
162
|
+
'TMH_TIMEDTEXT' => 710,
|
163
|
+
'TMH_TIMEDTEXT_TALK' => 711,
|
164
|
+
|
165
|
+
# Extension:QPoll
|
166
|
+
'QPL_INTERPRETATION' => 800,
|
167
|
+
'QPL_INTERPRETATION_TALK' => 801,
|
168
|
+
|
169
|
+
# Extension:SemanticMustacheFormat :3,
|
170
|
+
'SMF_MUSTACHE' => 806,
|
171
|
+
'SMF_MUSTACHE_TALK' => 807,
|
172
|
+
|
173
|
+
# Extension:R
|
174
|
+
'R_R' => 814,
|
175
|
+
'R_R_TALK' => 815,
|
176
|
+
|
177
|
+
# Extension:Scribunto
|
178
|
+
'SCR_MODULE' => 828,
|
179
|
+
'SCR_MODULE_TALK' => 829,
|
180
|
+
|
181
|
+
# Extension:SecurePoll
|
182
|
+
'SEP_SECUREPOLL' => 830,
|
183
|
+
'SEP_SECUREPOLL_TALK' => 831,
|
184
|
+
|
185
|
+
# Extension:CentralNotice
|
186
|
+
'CNT_CNBANNER' => 866,
|
187
|
+
'CNT_CNBANNER_TALK' => 867,
|
188
|
+
|
189
|
+
# Extension:Translate
|
190
|
+
'TRN_TRANSLATIONS' => 1198,
|
191
|
+
'TRN_TRANSLATIOTALK' => 1199,
|
192
|
+
|
193
|
+
# Extension:PackageForce
|
194
|
+
'PKF_PACKAGEFORCE' => 1300,
|
195
|
+
'PKF_PACKAGEFORCE_TALK' => 1301,
|
196
|
+
|
197
|
+
# Extension:BlueSpice
|
198
|
+
'BLS_BLOG' => 1502,
|
199
|
+
'BLS_BLOG_TALK' => 1503,
|
200
|
+
'BLS_BOOK' => 1504,
|
201
|
+
'BLS_BOOK_TALK' => 1505,
|
202
|
+
|
203
|
+
# Extension:Gadgets
|
204
|
+
'GDG_GADGET' => 2300,
|
205
|
+
'GDG_GADGET_TALK' => 2301,
|
206
|
+
'GDG_GADGET_DEFININTION' => 2302,
|
207
|
+
'GDG_GADGET_DEFININTION_TALK' => 2303,
|
208
|
+
|
209
|
+
# Extension:VisualEditor
|
210
|
+
'VSE_VISUALEDITOR' => 2500,
|
211
|
+
'VSE_VISUALEDITOR_TALK' => 2501,
|
212
|
+
|
213
|
+
# Extension:Flow
|
214
|
+
'FLW_TOPIC' => 2600
|
215
|
+
}
|
218
216
|
end
|
219
217
|
end
|