jpatokal / mediawiki-gateway

Ruby framework for MediaWiki API manipulation
Other
133 stars 50 forks source link

mediawiki-1.25 API incompatibility #69

Open GreyCat opened 9 years ago

GreyCat commented 9 years ago

I have a mediawiki-gateway based bot that I'd like to run on http://ru.wikipedia.org/ - last time I tried it on about ~2013-12, and it was ok back then, but nowadays I always get the following error:

D, [2014-10-09T08:05:41.453869 #30170] DEBUG -- : GET:
{"action"=>"query", "prop"=>"info", "intoken"=>"edit",
"titles"=>"User:WebAnalyticsBot/testing", "format"=>"xml",
"maxlag"=>5}, {"ruwikiSession"=>"466dfb2ce72418b74400629b25975cc0",
"GeoIP"=>"RU%3AMoscow%3A55.7522%3A37.6156%3Av4", "Path"=>"%2F",
"Domain"=>".wikipedia.org", "centralauth_User"=>"WebAnalyticsBot",
"domain"=>".wikipedia.org", "centralauth_Token"=>"...",
"centralauth_Session"=>"...", "forceHTTPS"=>"true",
"ruwikiUserID"=>"1084957", "ruwikiUserName"=>"WebAnalyticsBot"}

D, [2014-10-09T08:05:41.741127 #30170] DEBUG -- : RES:
<api><warnings><info xml:space='preserve'>The intoken parameter has
been deprecated.</info></warnings><query><normalized><n
from='User:WebAnalyticsBot/testing'
to='User:WebAnalyticsBot/testing'/></normalized><pages><page
contentmodel='wikitext' counter=''
edittoken='a03becb45126ea2136e40e3f7cc2e1e2+\' lastrevid='60065217'
length='2' ns='2' pageid='4652026' pagelanguage='ru'
starttimestamp='2014-10-09T04:05:41Z'
title='User:WebAnalyticsBot/testing'
touched='2013-12-12T18:01:51Z'/></pages></query></api>

/var/lib/gems/2.1.0/gems/mediawiki-gateway-0.6.2/lib/media_wiki/gateway.rb:1071:in
`warning': API error: code 'warning', info 'API warning: The intoken
parameter has been deprecated.' (MediaWiki::APIError)

Basically, it seems that mediawiki-gateway tries to use action=query&prop=info&intoken=edit stuff, which seems to be deprecated now:

* prop=info (in) *
  Get basic page information such as namespace, title, last touched date, ...
  https://www.mediawiki.org/wiki/API:Properties#info_.2F_in
[...]
  intoken             - DEPRECATED! Request a token to perform a data-modifying action on a page

It's probably a fairly vital issue, as it makes mediawiki-gateway totally unusable in current Wikipedia's installation environments, at least out of the box.

As far as I understand, it's not necessary to request a token, it would be given out automatically anyway in modern Mediawiki installations - probably this could be simply fixed by removing intoken= setting.

GreyCat commented 9 years ago

@blackwinter suggested to try ignoring warnings by :ignorewarnings => true in MediaWiki::Gateway.new - I confirm that it works around the issue.

blackwinter commented 9 years ago

Thanks for filing this issue.

For the record: The MediaWiki version used by Wikipedia (currently 1.25wmf1) is bleeding edge and not publicly released yet. The underlying change, however, has even greater ramifications (wikimedia/mediawiki-core@fdddf94) and will be released in 1.24, scheduled for next month.

GreyCat commented 9 years ago

Thanks for checking the Mediawiki version history for me. Wow, I never thought that Wikipedia devops are so bold to live off the bleeding edge in production %)

jpatokal commented 9 years ago

For better or worse, MediaWiki is Wikipedia, and they've been running those unreleased "wmf" versions for years.

blackwinter commented 9 years ago

Related to #76.

jaredbeck commented 8 years ago

@blackwinter suggested to try ignoring warnings by :ignorewarnings => true in MediaWiki::Gateway.new - I confirm that it works around the issue.

Is it still necessary to use this workaround?

jaredbeck commented 8 years ago

Here's another warning from MW 1.25, raised by MediaWiki::Gateway::Users#options.

MediaWiki::APIError: API error: code 'warning', info 'API warning: action=tokens has been deprecated. Please use action=query&meta=tokens instead.'

jpatokal commented 8 years ago

This is not going to get fixed unless somebody sends in a pull request.

Also, given that WMF has now released an "official" client at https://github.com/wikimedia/mediawiki-ruby-api, I will likely be deprecating this library entirely soon.

jaredbeck commented 8 years ago

.. given that WMF has now released an "official" client .. I will likely be deprecating this library entirely ..

Makes sense, thanks.