Commit graph

284 commits

Author SHA1 Message Date
umherirrender
0a5e1bf76a Add DebugInfos to api result
This allow to get the queries of the api due the same api request,
when setting $wgDebugToolbar = true, that acts like the inline script
added to index.php

Change-Id: I7c121822827137ba098d95a54ec90f824e0ddf01
2012-05-13 11:20:04 +02:00
Tim Starling
f8e0327656 Fix for r113993: don't log UsageException instances
Change-Id: I205252534fcf7a0ee486938123c1e15cd036f4f1
2012-05-08 11:05:09 +10:00
Szymon Świerkosz
a6cd69d83a (bug 18195) Allow changing preferences via API
I have created an API module for changing the preferences.
It allows resetting preferences (reset argument) and bulk changes
of preferences (change argument) in a format:
name1=value1|name2=value2

The change argument has a limitation imposed by the current API
implementation as it cannot accept | in values. There is
available a pair of arguments optionname and optionvalue, the
latter accepts values with |.

I have created optionstoken parameter in meta=userinfo to provide
a token. There is already preferencestoken there, but I would
like to have a consistent naming.

Change-Id: I0d6c654a7354ba77e65e338423952a6a78c1150f
2012-04-20 16:56:27 +10:00
Szymon Świerkosz
d66a00d8f3 Fix gettoken loophole from https://gerrit.wikimedia.org/r/#change,4220
Reported and patch by Szymon Świerkosz/Beau

Change-Id: I3b5a001ad60e7e637b351331794cb275a7cf021a
2012-04-15 18:40:20 +01:00
Brion VIBBER
179704bb20 Merge "(bug 27757) API method for retrieving tokens" 2012-04-05 18:34:50 +00:00
Reedy
d1e90b650d Bug 35671 - PHP Notice: Undefined index: gettoken in includes/api/ApiMain.php on line 598
Change-Id: I220dfcd964ceb4254b310140b916a7c63a3044ef
2012-04-03 19:07:33 +01:00
Reedy
df3e3943bd Bug 35646 - ApiBlockTest::testMakeNormalBlock() broken
Change-Id: I964cde249ce7193cb1ba8c3430645c36067876fb
2012-04-02 19:12:20 +01:00
Kaldari
9ec8e3525b (bug 27757) API method for retrieving tokens
Change-Id: I58bc5847b996d100712781052f20150f76786ed1
2012-04-02 18:06:03 +01:00
Reedy
13169c88c1 * (bug 34212) ApiBlock/ApiUnblock allow action to take place without a token parameter present
* (bug 35317) CSRF in Special:Upload
Revert r56793, which removed the CSRF check for Special:Upload for normal file
uploads. Cross-site posting of file uploads without user interaction has been
possible since at least as early as Chrome 8 (late 2010) and Firefox 6 (mid
2011).

Commonist has used api.php since version 0.4.0 (April 2010), and the API
already requires an edit token, so Commonist 0.4.0+ is not affected by this
change.

* (bug 34907) Fix for CSRF vulnerability due to mw.user.tokens. Patch by Roan
Kattouw and Tim Starling.
* Filter out private modules early in ResourceLoader::makeResponse() and just
pretend they weren't specified. This means these modules cannot be loaded
through load.php . This filtering must not happen in makeModuleResponse(),
because that would break inlining.
* Force inlining of private modules in OutputPage::makeResourceLoaderLink(),
disregarding $wgResourceLoaderInlinePrivateModules
* Remove $wgResourceLoaderInlinePrivateModules
* Remove special treatment of private modules ($private) in
ResourceLoader::makeResponse() and sendResponseHeaders(), because we're not
allowing private modules to be loaded through here any more
* Remove identity checks in ResourceLoaderUserOptionsModule and
ResourceLoaderUserCSSPrefsModule, they didn't make a lot of sense before but
they're certainly useless now.
* Factored out error comment construction in ResourceLoader.php and stripped
comment terminations from exception messages. I didn't find an XSS
vulnerability but it looked scary.

Patchset2:
 Removes whitespace error that prevented automatic merge by Gerrit:
 includes/resourceloader/ResourceLoaderUserOptionsModule.php

Change-Id: I2dec8b8caf9db3c64919763865cc10cccdd6a1a3
2012-03-26 11:46:46 +02:00
Sam Reed
9a4b6317f3 Make UsageException extend MWException 2012-03-16 02:02:41 +00:00
Sam Reed
cfef03d281 Bug 34032 - API help header not aligned
$ocd++;
2012-01-30 10:15:20 +00:00
Antoine Musso
44b06f908e reverts Concurrency works
trunk is frozen pending stabilisation so we can release MediaWiki 1.19.
Those changes introduces API changes and new SQL tables, so that sounds like
new feature we do not have time to review right now.

Please reapply changes in branches/concurrency and have code review handled
there. Once the branch has been reviewed, please hold. Once trunk is stable
enough and 1.19 got branched, you are welcome to merge the branch in trunk.

Note: we can have a Jenkins jobs setup to run the branch tests if you need.

Reverts:
r108595 r108591 r108585 r108584 108572 r108564 108560 r108559
2012-01-11 09:05:56 +00:00
Ian Baker
b3c84ce261 MERGE branches/concurrency 108301:108557 into trunk 2012-01-10 23:03:03 +00:00
Sam Reed
219b06f28f * (bug 33483) One space to much in header of auto-generated documentation 2012-01-03 15:49:10 +00:00
Jeroen De Dauw
49cdca93be add missing deprecation notices and added deprecation version to existing ones 2011-12-13 05:19:05 +00:00
Sam Reed
53000baecf Oh noes, moar http:// -> https:// 2011-11-28 15:43:11 +00:00
Sam Reed
af5d190302 Https for all!
(omg, this hadn't been reported)
2011-11-28 15:17:46 +00:00
John Du Hart
2e7d867478 Removed the 'eclipse helper' bit on top of every API module
It's a parctice that dates back to 2006 when the API was first written, and frankly isn't covered by the coding conventions. Same thing with the docblocks, they're all copypasted with some bits changed and don't even make sense if you look at them in the genereated code docs.
I don't feel that any of us depend on this anymore (get a better IDE), so in the inerest of consistancy it's time we said goodbye to it.
2011-11-16 00:17:26 +00:00
Roan Kattouw
2ff455acb7 Remove commented-out variable ApiMain::$mRequest 2011-11-14 19:44:13 +00:00
Alexandre Emsenhuber
dff6f25d5d Use the local context instead of $wgOut, now that we have one 2011-11-08 16:06:59 +00:00
John Du Hart
148180719d Followup r100927 and r100905, when setting a FauxRequest use the NEW context 2011-10-29 16:14:11 +00:00
John Du Hart
2cd44197fc Followup r100905, cleanup per CR and fixes the overriding of the main RequestContext 2011-10-27 01:13:19 +00:00
John Du Hart
40f19e6def Adding context to the API
This will probably break something somewhere so when it does please yell at me on IRC and I'll fix it.
2011-10-26 23:27:01 +00:00
John Du Hart
d021e1e965 Followup r100847, ApiMain now respects $wgShowHostnames 2011-10-26 19:39:56 +00:00
John Du Hart
83b50f5a8e Small todo note about ApiMain 2011-10-26 19:04:46 +00:00
Roan Kattouw
403f87be35 Rename $wgVaryOnXFPForAPI (introduced in r93818) to $wgVaryOnXFP and extend it to also apply to HTTP redirects. The previous name was overly specific for what has become a more generic setting, and we can still change it now that it's not in any release yet. 2011-10-03 13:15:28 +00:00
Sam Reed
a509bf41be Fix whitespace
Swap xor for ^

Documentation
2011-09-07 21:14:55 +00:00
Roan Kattouw
b5e0850f04 Introduce $wgVaryOnXFPToAPI which sends Vary: X-Forwarded-Proto (and the appropriate XVO, if needed) on cached API requests. This effectively splits the API cache between HTTP and HTTPS for people with an HTTPS termination setup in front of a caching proxy (like, say, WMF) 2011-08-03 12:00:47 +00:00
Sam Reed
302f7dccfd Add a couple more useful URL's to the API help banner
Add help url for ApiQueryDeletedrevs
2011-07-17 17:23:51 +00:00
Sam Reed
25ea9b8d95 Replace more multiple calls to $this->getResult() in methods with temporary variable 2011-06-30 01:06:17 +00:00
Sam Reed
b161823573 * (bug 26763) Make RSS/Atom of user contributions more visible
Add ApiFeedContributions module

Somewhat duplicated against Special:Contributions?feed=atom

Going to strip out that functionality
2011-06-06 14:50:34 +00:00
Sam Reed
fe332e78ac Followup r89528, don't use $wgRequest use $this->getMain()->getRequest()->response()/$this->getRequest()->response() (the latter when we're already in main!)
Also fix up a couple of calls to getMain() when we're already in a main class!?
2011-06-05 20:29:47 +00:00
Sam Reed
29d159aeba * (bug 22179) Internal use of API (FauxRequest) results in HTTP headers being set
Per Chad, switch API to use WebResponse::header() wrapper

Add $http_response_code to WebResponse::header()


Fix some code spacing/whitespace issues
2011-06-05 19:51:31 +00:00
Sam Reed
f4b92d6b4b Add missing word to r89505 2011-06-05 15:12:38 +00:00
Sam Reed
559277b2e3 * (bug 29265) Mediawiki API documentation incomplete
Add text about erroneous requests when sent to the api

Remove extra //, and add some documentation
2011-06-05 15:10:11 +00:00
Sam Reed
94a8c58fbc * (bug 29265) Mediawiki API documentation incomplete
Flesh out documentation for the maxlag parameter
2011-06-04 11:31:22 +00:00
Antoine Musso
6a8e32e986 Single messages can be passed as strings to Api::dieUsageMsg()
Since r88045
2011-05-19 17:51:16 +00:00
Sam Reed
3441def388 Documentation
Remove long deprecated isBot()/isSysop() in ApiMain
2011-05-08 16:48:30 +00:00
Sam Reed
f985524076 More versions added to @deprecated tags
Couple of inbound calls fixed up

Some ancient code removed as it's been marked deprecated
2011-05-06 21:50:18 +00:00
Max Semenik
40107fa464 Added a function that returns the list of supported formats to ApiMain 2011-05-03 16:54:16 +00:00
Sam Reed
c8079f0b81 * (bug 27185) API: Add Special:ComparePages 2011-05-01 21:56:02 +00:00
Chad Horohoe
783d4e0862 Remove @static from all over the place. That's what the static keyword is for, this being PHP5 and all 2011-04-21 00:07:09 +00:00
Bryan Tong Minh
f9a36ee7bf (bug 27018) Added action=filerevert to revert files to an old version. Copied procedure from FileRevertForm, as most of the verification procedure is simple enough to not warrant the effort of writing a dedicated backend.
Further changes:
* Added Status::getErrorsByType() which returns the internal error array untouched
* Added ApiResult::convertStatusToArray() which converts a Status object to something useful for the Api
2011-03-05 17:23:35 +00:00
Alexandre Emsenhuber
60f1302644 Per Platonides, fix for r82686: make ApiUploadTest work again
Added option request parameter to User::editToken() and User::matchEditToken() and use them where possible from the api.
Also removed $_SESSION usage since it's no longer needed
2011-03-02 12:52:47 +00:00
Sam Reed
27ca6b2fa8 Tweak comments, remove some unused stuff.
Explicit definitions, move a few minor bits around
2011-02-27 21:10:11 +00:00
Sam Reed
32eb80c15c A few return type hints 2011-01-30 08:16:13 +00:00
Sam Reed
3403f6d2c3 * (bug 26650) Remove $wgAPICacheHelp in favour of $wgAPICacheHelpTimeout 2011-01-10 18:08:54 +00:00
Sam Reed
2616a18522 Widen documentation header also 2011-01-07 03:12:07 +00:00
Sam Reed
981e47d801 Widen api help splitters 2011-01-07 03:04:03 +00:00
Sam Reed
f63b5040e3 More minor bits of documentation
Object type hint on mPrinter
2010-12-23 19:53:28 +00:00