Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F35535373
check_restbase_config.rb
Public
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
matmarex
Sep 26 2022, 7:04 PM
2022-09-26 19:04:38 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
DAlangi_WMF
Tokens
"Burninate" token, awarded by DAlangi_WMF.
check_restbase_config.rb
View Options
require
'pp'
require
'uri'
require
'net/http'
restbase_config_url
=
'https://raw.githubusercontent.com/wikimedia/mediawiki-services-restbase-deploy/master/scap/vars.yaml'
rb_config_wikis
=
Net
::
HTTP
.
get
(
URI
(
restbase_config_url
)
)
.
split
(
/\n/
)
.
drop_while
{
|
ln
|
ln
.
strip
!=
'domains:'
}
.
select
{
|
ln
|
ln
.
include?
(
':'
)
&&
ln
.
start_with?
(
' '
)
}
.
map
{
|
ln
|
ln
.
split
(
':'
)
[
0
].
strip
}
def
dbname_to_url
dbname
@data
||=
begin
data
=
File
.
readlines
(
'wmf-config/InitialiseSettings.php'
)
.
drop_while
{
|
ln
|
ln
.
strip
!=
"'wgServer' => ["
}
.
drop
(
1
)
.
take_while
{
|
ln
|
ln
[
0
]
==
"
\t
"
||
ln
.
strip
==
''
}
.
select
{
|
ln
|
ln
.
include?
'=>'
}
.
map
{
|
ln
|
ln
.
sub
(
'//'
,
''
)
.
sub
(
%r~(//|#).+~
,
''
)
}
# strip comments and leading // in URLs
# meh
eval
"{
#{
data
.
join
"
\n
"
}
}"
end
if
@data
[
dbname
]
@data
[
dbname
]
else
family_dbname
=
@data
.
keys
.
find
{
|
k
|
dbname
.
end_with?
k
}
||
'wikipedia'
family_dbname_suffix
=
family_dbname
==
'wikipedia'
?
'wiki'
:
family_dbname
@data
[
family_dbname
].
sub
'$lang'
,
dbname
.
sub
(
/
#{
family_dbname_suffix
}
$/
,
''
)
.
gsub
(
'_'
,
'-'
)
end
end
dblists_url
=
'https://raw.githubusercontent.com/wikimedia/operations-mediawiki-config/master/dblists/'
rb_inuse_wikis
=
(
Net
::
HTTP
.
get
(
URI
(
dblists_url
+
'all.dblist'
)
)
.
split
(
/\n/
)
-
Net
::
HTTP
.
get
(
URI
(
dblists_url
+
'wikitech.dblist'
)
)
.
split
(
/\n/
)
-
Net
::
HTTP
.
get
(
URI
(
dblists_url
+
'closed.dblist'
)
)
.
split
(
/\n/
)
-
Net
::
HTTP
.
get
(
URI
(
dblists_url
+
'private.dblist'
)
)
.
split
(
/\n/
)
)
.
map
{
|
s
|
dbname_to_url
s
.
strip
}
puts
"RESTBase configured:
#{
rb_config_wikis
.
length
}
wikis"
puts
"RESTBase in use:
#{
rb_inuse_wikis
.
length
}
wikis"
puts
"RESTBase configured but not in use:"
puts
(
rb_config_wikis
-
rb_inuse_wikis
)
.
map
{
|
s
|
"*
#{
s
}
"
}
puts
"RESTBase in use but not configured:"
puts
(
rb_inuse_wikis
-
rb_config_wikis
)
.
map
{
|
s
|
"*
#{
s
}
"
}
File Metadata
Details
Attached
Mime Type
text/x-ruby
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
9751859
Default Alt Text
check_restbase_config.rb (1 KB)
Attached To
Mode
T318325: VisualEditor throws "Error contacting the Parsoid/RESTBase server (HTTP 404): (no message)" on affiliate wiki
Referenced
Detach File
Event Timeline
DAlangi_WMF
awarded a token.
Sep 27 2022, 3:25 PM
2022-09-27 15:25:25 (UTC+0)
DAlangi_WMF
subscribed.
Log In to Comment