Page MenuHomePhabricator

ApiLanguageSearch implements ApiBase::getCustomPrinter for no good reason
Closed, ResolvedPublic

Description

There is no reason for the data provided by this module to not be retrievable using other supported API formats.

Note that the module currently defaults to format=json, while fixing this will likely have it use the normal default format=jsonfm. Callers should be checked to ensure they're explicitly requesting format=json so they won't break when this is fixed.

Event Timeline

Anomie raised the priority of this task from to Low.
Anomie updated the task description. (Show Details)
Anomie moved this task to Non-core-API stuff on the MediaWiki-API board.
Anomie added a subscriber: Anomie.
MtDu added a subscriber: MtDu.

I'll fix this.

Change 264862 had a related patch set uploaded (by MtDu):
Remove getCustomPrinter from ULS extension

https://gerrit.wikimedia.org/r/264862

There is a reason: to avoid decoding and re-encoding the JSON all thet ime. I am not claiming it is a good reason though.

There is a reason: to avoid decoding and re-encoding the JSON all thet ime.

No, the better solution would be for clients that want JSON to ask for format=json, and allow clients that might prefer format=php or format=xml to be able to use those formats.

Note this task doesn't apply to ApiULSLocalization, although looking at that more closely now I wonder why you're using ApiFormatRaw to output a freshly-encoded JSON blob there instead of using the normal API result formatting mechanism.

Ok I was confused for a moment and talking about ApiULSLocalization. For ApiLanguageSearch I don't see any reason.

For ApiULSLocalization I remembered incorrectly... the reason is to not avoid re-encoding (which actually happens) but that the output has to be in a particular format.

Ah, it's for jquery.i18n. That makes sense then. I wonder whether it should implement isInternal() to return true, though, and/or mention the fact in its description.

I wonder whether it should implement isInternal() to return true

I am quite sure the answer is yes.

Change 264862 merged by jenkins-bot:
Remove getCustomPrinter from ULS extension

https://gerrit.wikimedia.org/r/264862