Commit graph

17 commits

Author SHA1 Message Date
Alex Monk 893eaad6af Don't restrict format parameter in the API
Bug: T91455
Change-Id: I847a0b70d437d6789f32e40199ea602ca3bfa6c8
2016-01-19 22:03:41 +00:00
Roan Kattouw 6580dc3e87 Work around 1c57794e3 in MW core mangling boolean properties
Bug: T96443
Change-Id: Ib5901791c68f4c761fb4cc25578d6ce6493624d5
2015-04-17 16:47:07 -07:00
Brad Jorsch a9ac3e201f Add i18n for API module help
MediaWiki core change I04b1a384 added support for i18n of API module
help. This takes advantage of that while still maintaining backwards
compatibility with earlier versions of MediaWiki.

Once support for MediaWiki before 1.25 is dropped, the methods marked
deprecated in this patch may be removed.

Change-Id: I67395aff48185f3e09da31b51a08aa2541fe6a17
2014-10-29 14:59:23 -07:00
addshore 40907dd714 Remove use of deprecated getPossibleErrors (since 1.24)
Change-Id: I30d3ccc834dcc7eaa9534cfb7c5c6047752f147b
2014-08-29 11:53:53 +01:00
Alex Monk bd129b7c6a Allow following of redirects via API
Bug: 50964
Change-Id: If6fb5856c4f8bcd32ad51dcccec491894ff4bc9f
2014-05-23 18:25:13 +01:00
Timo Tijhof ccacbe4b41 license: Add COPYING file for GNU GPL v2
The only file with a license mention so far was ApiTemplateData.php.
It was documented on mediawiki.org[1] as "GPL v2".

[1] https://www.mediawiki.org/wiki/Extension:TemplateData

Change-Id: I85cdd5d511f8578888127888d11c2642aad49842
2014-03-13 23:19:19 +01:00
Timo Tijhof 1d419069d5 api: Pass through $data directly instead of copying by property
* Prevent mistakes such as fixed by Ic5b42c4189.
* Expose the previously-suppressed Root#sets property.

Change-Id: I0d5bf9f7b742db8b49d0af23371389b0a4cdf7a4
2014-01-17 15:53:08 +00:00
Trevor Parscal 253c11e53f Send paramOrder through the API
Change-Id: Ic5b42c4189868412138680654c499b6c8bc8f47e
2014-01-14 11:49:21 -08:00
Timo Tijhof 4615338a51 Implement getInterfaceTextInLanguage and use API and Parser
Fallback for user language and content language is easiest to
resolve server-side. Also saves sending a lot of data to the
client that it doesn't need. Similar to how ResourceLoader only
sends 1 set of message values.

Bug: 50431
Bug: 52922
Change-Id: If8317ed6522a05d5a48a210ff43c97277b950a97
2013-10-07 19:26:59 +02:00
MatmaRex d66b4c6090 Store compressed JSON since size is limited
We only have 65535 bytes, let's use them wisely.

Prior to Ib2db241a in core (1.22wmf12) even binary page properties
were sometimes shown as plaintext (e.g. on Special:PagesWithProp).
Thus this introduces a "soft dependency" on that change.

No backwards-incompatible changes were made in public methods.
Added two new ones:

* Add TemplateDataBlob#getJSONForDatabase which returns compressed
  JSON, use it where applicable.
* Add TemplateDataBlob::newFromDatabase which accept compressed and
  uncompressed JSON, use it where applicable.

Use a long pseudorandom string in the test.

Bug: 51740
Change-Id: Ie66b0dd6b6dab6f8648e78595c41e52d9c704d57
2013-09-04 22:52:02 +00:00
MatmaRex 6887e01e6e ApiTemplateData: Fixed a typo in error message
Change-Id: Ib273c89dd5981e6ac613ed3901ec91b19ad767be
2013-07-23 16:26:58 +02:00
aude f41e9d57cf Fix api help url
Change-Id: I49da3832e4905e659fd3d4f33b5470e48a3ccab6
2013-07-15 00:15:04 +00:00
Trevor Parscal 0eba4ae7b3 ApiTemplateData: Expose root description property
Change-Id: I3727ea9e8b4f7c45b08690dcf610527f1df73022
2013-05-29 10:38:20 +00:00
Timo Tijhof 70ab71d6a3 phpcs: Resolve style violations
Change-Id: Ie5d4d84b8d7b6bc88e7a5a1559579e504dd1bd20
2013-05-16 15:31:25 +00:00
Timo Tijhof 942c88f749 API: Update/Normalise before outputting
I ran into countless random exceptions and errors locally due to
cache I built up over time that was no longer valid. Though in
approved commits in the repository there is only 1 version as of
now, I'm sure we will make changes in the future that require a
cache invalidation since getHtml needs to be able to make
assumptions about what properties exist.

Also fixed a bug in the parse() method where the 'deprecated'
property is asserted the wrong way around. Added a test for it.

Change-Id: I5f61d6030578a711909435c8b996373e9aaa5178
2013-04-23 23:52:37 +00:00
Timo Tijhof 30b4a592c6 API: Transform into a standalone module instead of a query submodule.
Change-Id: Ia858fa43a50ade947e6353d22dc89a519c3da61a
2013-03-30 01:53:39 +01:00
Timo Tijhof b7080c5f90 Initial TemplateData commit
Registers a parser tag <templatedata> that should have a JSON
blob as content. The blob is then validated and normalised when
MediaWiki parses the page (e.g. during save and preview).

If there are validation errors, the save is aborted from the
extension hook and an error is displayed.

If all goes well, the normalised blob is stored in the database
(which can be retrieved through the API). And an HTML
representation of the template parameters is returned to the
wikitext parser to show where the <templatedata> was in the page.

The blob format is specified in spec.templatedata.json and
is validated in TemplateDataBlob::parse.

Bug: 44444
Change-Id: Icf305892a9512545a63f5a5280cc0d340c61585f
2013-03-14 19:19:55 +00:00