Commit graph

203 commits

Author SHA1 Message Date
Kevin Israel
1402236c4b Remove use of OutputPage::addParserOutputNoText()
Simply clicking "Show preview" on the edit page triggered a deprecation
warning.

Also removed the wfDeprecated() call from the method, which is still used
in a few WMF-deployed extensions without a corresponding open change.

Follows-up e8f1fede77.

Change-Id: I2cfdc84b92cf13478b9f462028d525e4ec14fdf2
2014-06-24 04:53:44 -04:00
Kunal Mehta
933df271be ApiParse: Add disableeditsection parameter
To disable edit section links in the parser output

Bug: 62723
Change-Id: I499c4bb0cd85964e78db3362e13a8033a2e9aed0
2014-06-20 23:09:18 -07:00
Reedy
e48ecbc524 Switch API to use Config classes
Only done where globals are config (so not $wgParser, $wgContLang etc)

Change-Id: Ic39cdd858cfb9096a2bc09618f97e64270d76f13
2014-06-15 23:56:38 +01:00
Bartosz Dziewoński
1abe2525cd ApiParse: Add prop=modules
action=parse&prop=modules now provides the ResourceLoader modules used
on the page (included in the ParserOutput object). This is intended to
be used by the live preview functionality.

Bug: 24134
Change-Id: Ib5032e4eeaf6bb97dac965c580a5107437c7bbd4
2014-04-29 22:12:12 +00:00
Siebrand Mazeland
f994817f6b Pass phpcs-strict on various files in includes/
These files have all had treatment before, and these occurrences have either
been missed or have been introduced after.

Change-Id: I06cdab4616b5bff47c85152df28f18c861730a23
2014-04-24 21:50:01 +02:00
umherirrender
e63299d208 Fixed some @params documentation (includes/api)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I758fa4ad80ac95e2ddd3770bcb9b7d2e57ec34ea
2014-04-18 13:55:36 +00:00
addshore
719d7a2f03 Add final period to API module descriptions
Change-Id: Icae68c1ab1fd0006e00a3a9a56ae8f831d3d0d45
2014-03-10 09:04:08 +00:00
umherirrender
d99e39a97f Remove final period from api module descriptions
The most description are without a final period, so that looks common.

Change-Id: If72a3cc094cfff436b53948728354cbaeff768c8
2014-03-02 20:20:56 +01:00
Brad Jorsch
3927a8fc65 API: Fix PHP warning in action=parse help output
Change I0f41c837 removed a variable while it was still in use.

Bug: 61210
Change-Id: I91ad2e374a85e149303c6e8da7c3d94c1285a72a
2014-02-11 10:36:14 -05:00
umherirrender
0f05a201c7 Provide language names on action=parse&prop=langlinks
This can helps the client to build a language html.

Bug: 58627
Change-Id: Iaa475cbe7b0268ee86e40ec0fa42bbe51bba02c9
2014-02-10 15:44:14 +00:00
umherirrender
57551f4252 Add prop 'limitreportdata' and 'limitreporthtml' to action=parse
This allows the get the limit report in provided uselang and not only
the english version out of the parsed html.

Change-Id: I2efc606623190756f5c993f48ef29bb0d384a95b
2014-02-07 19:14:13 +01:00
Sorawee Porncharoenwase
f554d1871c API: update documentation and suppress warning when parsing summary
The documentation states that if contentmodel and title are not given,
but text exists, "wikitext" will be the default model. However, the
actual code will show a warning if do so. This patch fixes the inconsistence
by removing some parts of the documentation which encourages giving
only text as the parameter and corrects the example. The patch
also suppresses the warning that contentmodel must be given when
summary parameter is given.

bug: 60192
Change-Id: I0f41c83763fbb5551aa3ceaff59c1f8fe38310be
2014-02-07 15:24:57 +00:00
Brad Jorsch
83a51c0e71 API: Allow special pages for action=parse&title=
Iec98e472 had broken this. Use the same strategy as in
MediaWiki::initializeArticle to work around the problem.

Bug: 49477
Change-Id: Ib272b1f9395f6adade505ac7c6a24f9a4bff2779
2014-01-09 11:56:02 -05:00
Max Semenik
36fd28184a API: allow disabling TOC in action=parse
Change-Id: If9652bbae97ce40c8695affeb28be6088949dfd2
2013-12-18 02:31:17 +04:00
Siebrand Mazeland
b07a2219fb Document future removal of action=parse&prop=languageshtml
Change-Id: I600bbac02633f3b17044602917d062106ae83867
2013-12-02 12:03:01 +01:00
Siebrand Mazeland
ca209473d1 Remove unneeded uses of else{} in api/
Fixed a little documentation issue, removed a line of unreachable code
and fixed up two formatting issues in the process.

Change-Id: If29391ee1a0daf19973437f36c3216b8716debd0
2013-11-18 21:34:43 +01:00
Siebrand Mazeland
5e3fab3930 Fix inconsistent line break
Change-Id: I42098f3bdbf470bd9de1d29ad64005dfd6f7e134
2013-11-17 18:37:00 +00:00
Siebrand Mazeland
1707a7995e Fix CodeSniffer errors and warnings (final round for API classes)
Change-Id: I97bf36ebef254818dc17378a06405b681ad19c59
2013-11-15 10:33:50 -08:00
Siebrand Mazeland
c6630e8bbe Update formatting on API classes, Part 3
Change-Id: I526be68e21836201c992b391a81f4d41e1fa801e
2013-11-14 18:12:29 +00:00
Brad Jorsch
b78b9131a8 API: Have action=parse indicate hidden categories
Also whether the category page exists, since we can get that basically
for free along with the 'hidden' flag.

Bug: 54884
Change-Id: I5c435f04b1b3b65c4153dea1767d48b49ed427c2
2013-11-04 12:20:56 -05:00
Brad Jorsch
652cfa803b Improve documentation of action=parse (followup Ie4f7324c)
The documentation for action=parse needs clarification, particularly in
light of the changes made in Ie4f7324c which were too hastily merged.

Also, add the RELEASE-NOTES entry missing from Ie4f7324c.

Change-Id: Ia8847f7e99620a9f7af24956d972c882f78aae26
2013-06-19 10:53:57 -04:00
Niklas Laxström
1104392eba Restore API action=parse&text=foo functionality on wikidata.org
Bug: 48201
Change-Id: Ie4f7324c2a10700e52dadc4facd6b4fe6c76cf48
2013-06-19 11:07:41 +00:00
Brad Jorsch
484770e8d2 API: Fix action=parse without any page or title or text
action=parse was raising an error about missing 'text' with 'title' even
when 'title' wasn't actually passed, due to a fix for bug 33865. But
this broke using action=parse to parse an edit summary without also
giving it wikitext to parse.

Instead, let's give the client a warning (unless it seems clear they
know what they are doing) and assume the empty string for 'text'.

Also, while we're editing the file, add some more examples as also
requested in bug 48319.

Bug: 48319
Change-Id: I03c1fbcb0bd31dea8bd84e164104f7ced0ace449
2013-06-13 20:58:27 -04:00
Max Semenik
5d3374f48e Add section preview mode to API action=parse
In https://gerrit.wikimedia.org/r/#/c/67266/, it was enabled automatically
when a section was specified in preview mode. However, this only works for
previews of a saved page's content, failing for user input previews which
might contain several sections of various degrees of nestedness.

Change-Id: I987144e5e315ed9e0a67f599083461a78879c0df
2013-06-13 02:46:04 +04:00
Max Semenik
d7a61d7223 action=parse now can parse in preview mode
Bug: 49239
Change-Id: Iacfea0219ef21dc91d669f51140ec129c2f41f76
2013-06-06 20:04:40 +04:00
umherirrender
e36883264f ApiResult::setContent is static
Change-Id: Ifee10208e8b79928ecaa47f541bb61dd6e9c29e4
2013-04-30 20:16:36 +02:00
daniel
8e7150b549 (bug 45535) Hook for changing language links.
This adds a new hook called LanguageLinks which is called
whenever a list of language links is returned to the user.
This gives extensions the option to manipulate the links
on the fly.

Note that this change only covers the language links used
in OutputPage and by ApiParse. Adapting ApiQueryLangLinks is
left as a follow-up task.

As explained on bugzilla, this is a precondition to
allowing Wikibase/Wikidata to update languagelinks without
forcing a (redundant) re-parse of the page content.

This change also introduces the notion of link flags that
can be used to associate flags with language links. This
will be integrated with ParserOutput and OutputPage in a
follow-up.

Change-Id: Iaec0faa131413a291fc8f77496e4f371addb3b99
2013-04-29 09:13:47 -04:00
Siebrand Mazeland
9b7889b84b Use American English spelling for behavior
Spotted in ipbreason-dropdown by Shirayuki.

Change-Id: I576ed4bc0abe5ab980aaee3fb9f9e4b43087311f
2013-03-04 10:24:57 +01:00
umherirrender
5880f89707 API: Throw error when interwiki is given for various title param
See bug 44341 for action=parse, but the problem with interwiki
processing can also be happen in other modules.

This gives clearer error message on some modules
For example action=move:
Bad title "*title*"
instead of:
Unknown error: "immobile-target-namespace-iw"

Change-Id: I86524533dfd778a169b39968999918a1f531efeb
2013-03-01 16:01:26 +01:00
umherirrender
f3cf109e62 remove space before semicolon
Change-Id: Ic0d890f5e27cec017c7f7910a67d53b2edf82079
2013-02-09 22:44:24 +01:00
Antoine Musso
b2fba3f27f api: remove duplicate __contruct calls
For historical reasons, all our API class had a dummy __construct which
simply calls their parent constructor.  This patch removes all such
occurences to save out some bytes.

Change-Id: I667955d7821f780fc5ce23823d74dedb1729b9fa
2013-01-29 09:38:17 +01:00
umherirrender
2e8da558ba fix some spacing
Change-Id: Id7eda67a43f9040117edd79fdbeb678f1c3a6da2
2013-01-26 22:11:09 +01:00
Yuri Astrakhan
503cd2f4ae (bug 35885) remove api version string and parameter
API was using SVN's version keyword which GIT does not support.
All related methods were either removed, or for those that
could have been used from extensions, emptied out.
api.php?version now shows unrecognized param warning.

Change-Id: I910ca1448ed2ed697ac19b17c486d130aa1d7e03
2013-01-18 12:41:18 -05:00
Yuri Astrakhan
32fd68f81c Minor cleanup
Fixed spacing, eol chars, "string" --> 'string'

Change-Id: I630247c6c5b469efb67ec9de32e8533ae88e59fb
2013-01-12 01:50:48 -05:00
Marius Hoch
d4133a3675 Fix uselang parameter in ApiWatch
It's now possible to use uselang with the watch API without
it throwing a warning (cause the parameter wasn't defined).
Idea and some code taken from ApiParse.

Change-Id: I74b7c4286c0c2f44fabc337d5fb744560f71cf71
2012-11-22 00:39:05 +01:00
umherirrender
185da8808e (bug 40574) hints for generatexml param in api modules
Change-Id: I782d64eed5faac6836a57463e195e64c4314199c
2012-10-30 10:16:04 +00:00
Catrope
9f936d5941 Merge "(bug 41042) Regression: API action=parse with nonexistent page" 2012-10-29 20:03:16 +00:00
Brad Jorsch
3756f810bc (bug 41042) Regression: API action=parse with nonexistent page
Changeset Iec98e472 changed the behavior of action=parse&page=... when
passed a page that does not exist: previously, it would return a
"missingtitle" error instead of assuming an empty page. As some people
had been depending on this old behavior, restore the error checking.

Change-Id: I4c76ce458ceb01e233c6074cd9251879013ec143
2012-10-29 13:38:33 -04:00
Reedy
f921b41f15 Swap isSpecialPage for canExist()
Add another check in ApiBase::getTitleOrPageId

Change-Id: I2123e3a3034cb815cf35f66f2fbf2b94fb27069f
2012-10-23 23:56:35 +02:00
Reedy
64075bb990 Don't try and run a special page through action=parsex
Change-Id: I1b4ca09b1674dbbde91acc6cade4dc1ff810bee5
2012-10-23 15:46:17 +01:00
aude
89694e81a5 check for null content in ApiParse.php
Change-Id: I32b3c02163f2295f91b680e3a5636105960b971a
2012-10-22 18:48:09 +00:00
Reedy
6bbe4076e1 A few more for bug 41122
Change-Id: I756067c8e40eafff87f8f448a9e037228afd3bf3
2012-10-20 00:17:59 +01:00
Reedy
b395523197 Bug 41122 - Catchable fatal error: Object of class ParserOptions could not be converted to string
Fix ApiParse occurence

Change-Id: I82db8bb6dff178e11a1e6731fbf2cd977daa804a
2012-10-19 21:12:55 +01:00
umherirrender
85d8ee1f87 Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I00f369641320acd7f087427ef031f3ee7efa0997
2012-10-10 20:14:40 +02:00
daniel
bb51a58e57 Cleanup of Wikidata branch.
This cleans up several issues raised in comments to I3b2dad3a,
mostly style and merge artifacts.

Change-Id: I99f5e300a671db1353db151cd187ffd2e4478d03
2012-10-08 17:34:47 +02:00
daniel
7af8c74e1a fix merge of Iec98e472
Change-Id: I0db2e30ce6e80d046c223bcf3e4d2569922e172f
2012-10-05 15:30:43 +02:00
daniel
b6b686c13b merged master
Change-Id: I0ef7c7f33a5dc5855f38b20c03ddc5306f38ec66
2012-09-19 12:34:10 +02:00
Alexandre Emsenhuber
14d159af7e Use Revision::isCurrent() in ApiParse.
We have a loaded Revision object so we may use that
method as well.

Change-Id: Ie8bb871f8874871d7df3111d39ba23a01769cd34
2012-09-17 20:14:27 +02:00
Alexandre Emsenhuber
be0878fd3a Use WikiPage::makeParserOptions() where possible.
- This is needed to for I90965346 ((bug 37453) Move
  $wgDisable(Lang|Title)Conversion to ParserOptions)
  because that change sets an option based on the Title,
  and I don't want to duplicate that to all ParserOptions
  that need it.
- Refactored ApiParse to have a WikiPage object available
  and changed some part to take advantage of having this
  object available. Also used ApiBase::getTitleOrPageId()
  to reduce code duplication.

Change-Id: Iec98e472af9c43d940f77261367a796b0d7b4b54
2012-08-31 23:16:03 +02:00
daniel
9994968774 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 15:20:15 +02:00