Page MenuHomePhabricator

Add flag to notify whether the API is enabled on another wiki
Closed, DeclinedPublic

Description

Not quite sure how we're gonna do this, or else, if this is a wontfix type of thing...

Moved from https://bugzilla.wikimedia.org/show_bug.cgi?id=16288#c2

(In reply to comment #2)

Would be good if sitematrix not only indicated whether a wiki is readonly, but
also whether the API is enabled at all there. Currently, trying an API call on
a wiki where the API is disabled completely just returns a text "MediaWiki API
is not enabled for this site. Add the following line to your
LocalSettings.php<pre>%lt;b>$wgEnableAPI=true;</b></pre>"
which is rather unhelpful for automated processing. For instance, when using
dynamically generated script-elements with a callback: what we get back isn't
even Javascript. Hence we need a way to ensure that we don't even try API calls
on such wikis. Sitematrix flagging wikis with disabled APIs would be one way.
Or is there some other way to do this already?


Version: unspecified
Severity: enhancement

Details

Reference
bz28126

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:25 PM
bzimport added a project: SiteMatrix.
bzimport set Reference to bz28126.
bzimport added a subscriber: Unknown Object (MLST).

For instance, when using
dynamically generated script-elements with a callback: what we get back isn't
even Javascript

Don't all api modules (minus help) require read rights, and when using json with a callback you're considered an anon? That'd make this rather pointless as you wouldn't be able to do anything with a json callback on a private wiki regardless of if the api was enabled.

But ignoring that, it seems it would make sense just to enable the api on all those wikis. Presumably the api is stable enough now that its very unlikely there's any way to get unauthorized info out of it.

Do we have an example of a site on the wikimedia matrix (or interwiki map?) which has the API disabled?

A quick fix (if not done already) would be to return a JSON error response when accessing an API that is disabled.

Note that we're currently discussing in T115414 whether we should ditch the "support" for MW functioning without the API at all. If we decide that yes, this feature request would be moot.

Pppery subscribed.

($wgEnableAPI no longer exists)