Page MenuHomePhabricator

API: consider making closure status of wikis more clear with meta=siteinfo
Closed, ResolvedPublic

Description

Author: Wiki.Melancholie

Description:
Although this is very Wikimedia specific, consider adding information whether a wiki's database has been closed (locked permanently) or not. There are many closed wikis out there, e.g. http://aa.wikipedia.org/w/api.php?action=query&meta=siteinfo

Currently, readonly="" shows that a database has been locked; temporarily or indefinetly. But an empty "" looks like "undefined"/"no". You could either add "yes"/1, and/OR for closed wikis even "closed".


Version: unspecified
Severity: enhancement
URL: http://aa.wikipedia.org/w/api.php?action=query&meta=siteinfo

Details

Reference
bz16288

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:24 PM
bzimport set Reference to bz16288.

Bryan.TongMinh wrote:

We probably need a hook which allows adding to siteinfo and have the SiteMatrix extension hook that.

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?

(In reply to comment #0)

Although this is very Wikimedia specific, consider adding information whether a
wiki's database has been closed (locked permanently) or not. There are many
closed wikis out there, e.g.
http://aa.wikipedia.org/w/api.php?action=query&meta=siteinfo

Currently, readonly="" shows that a database has been locked; temporarily or
indefinetly. But an empty "" looks like "undefined"/"no". You could either add
"yes"/1, and/OR for closed wikis even "closed".

readonly="" is the typical boolean way we do stuff. If it doesn't exist, it's false.

(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?

Logged as bug 28126, as it has some overlap of the issue, but not completely...

Doing the hook for this is trivial.

I'm just struggling (probably because it's late etc), how we can easily get the language/name out of wikiid()

if $wgDBname starts with wgLanguageCode, remove it, then we've got the project, based on what $wgSiteMatrixSites uses.

If anyone wants to sanity check that for me, I'd appreciate it.

I've added an isSpecial method in r84367

Added a hook locally, so will see if I can get SiteMatrix to play nicely locally... And do a bit more testing. In theory, just stealing the DBlists from noc should help there

eval.php:

$matrix = new SiteMatrix();

echo $matrix->isClosed( '', $wgDBname ) ? 'true' : 'false';

false

echo $matrix->getUrl( '', $wgDBname );

http://www.mediawiki.org

Seems to verify what I'm suggesting

  • Bug 28772 has been marked as a duplicate of this bug. ***