Commit graph

251 commits

Author SHA1 Message Date
Sam Reed
01caf960f2 Followup r82060
Calling intval() on an array of integers isn't going to get people very far

simplify logic, and then only do validation if $min or $max are not null
2011-03-03 23:22:39 +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
41e7860130 Implement getRequireOnlyOneParameterErrorMessages, to make the error messages requireOnlyOneParameter can throw.
Use in 4 modules for more dynamicness
2011-02-25 19:09:39 +00:00
Sam Reed
28f7bf1f2b Followup r82727, improve comments, cast return value to bool 2011-02-24 16:00:06 +00:00
Sam Reed
ab408b911d Seems the api edit watch/unwatch wasn't too well tested (after it got poked a lot)
EditPage::commitWatch() unconditionally  does a watch/unwatch...

And multiple watches of a watched page end up with an INSERT IGNORE, so not a big deal
2011-02-24 15:51:51 +00:00
Sam Reed
3721e827ac * (bug 27376) when using ApiBase::PARAM_TYPE => 'integer' without a min or max value, api doesn't validate the input is actually an integer
Fixup some space indention
2011-02-13 17:00:47 +00:00
Sam Reed
bfd67cf818 Remove some blank lines
Spaces to tabs in ApiBase
2011-01-07 02:53:00 +00:00
Sam Reed
1f05665cf3 Styleli[zs]e the API up to date (Been a while since) 2010-12-30 17:06:09 +00:00
Roan Kattouw
ea310d143f Followup r78824: add missing message 2010-12-29 20:20:55 +00:00
Sam Reed
f63b5040e3 More minor bits of documentation
Object type hint on mPrinter
2010-12-23 19:53:28 +00:00
Sam Reed
55ebd95afd * (bug 24287) Wrap/similar on api help output 2010-12-22 21:40:33 +00:00
Sam Reed
6309c920dd Delete all the "API for MediaWiki 1.8+" comments
Add since to ApiQueryQueryPage
2010-12-22 20:52:06 +00:00
Sam Reed
492ac9b4bf Followup r77666, bug 26219
Only add the message about multi value, if the type is not an array, or if it is an array, if it has over 50 (LIMIT_SML1) items
2010-12-04 00:36:33 +00:00
Sam Reed
612c934210 * (bug 26219) Show API limits for multi values in description
Also move bug 9675/r77612 RELEASE-NOTES to the correct section
2010-12-03 16:24:05 +00:00
Sam Reed
056b646308 Followup r74988, brion wins again ;D 2010-10-19 18:40:43 +00:00
Sam Reed
c85bf31cf3 Swap usage of create_function for defined function as a callback 2010-10-19 00:44:28 +00:00
Roan Kattouw
9c0b26028f Revert r74810 (vary API help cache on $wgUser->isAnon()) and move the POST check into the purge module. Also fix the permissions check in action=purge, which was totally broken and based on a misunderstanding of what the 'purge' right means. 2010-10-18 09:19:20 +00:00
Sam Reed
519173c0e4 Followup r74234 flip parameters 2010-10-04 21:18:38 +00:00
Sam Reed
9cda0105a9 Minor tweaks to r74232, add a value for $botMax on calls for integer validation (otherwise the bool gets pushed into it!)
Documentation in ApiDelete
2010-10-03 20:29:44 +00:00
Sam Reed
69107791db Followup r74230, if we make things array, we should make them not an array afterwards
Well, the more sane way, is just treat them seperately, than having to do $value = $value[0];, based on whether it was an array already

Cheers to Siebrand (was already poking it myself :))
2010-10-03 20:07:23 +00:00
Sam Reed
7ad52b7bdd First part of "*(bug 25303) API: integer parameter validation does not actually validate, only warn"
Actually make the validation of the range occur

Fix typo in ApiBase.php
2010-10-03 19:07:11 +00:00
Sam Reed
42b5c265c0 * (bug 25248) API: paraminfo errors with certain modules
Added a needsToken() function, rather than calling getTokenSalt, which can throw silly errors due to dependencies on parameters
2010-10-01 20:12:50 +00:00
Sam Reed
9d1e45bf42 Tweak/add some documentation as hints for some code analysis 2010-09-28 01:33:11 +00:00
Sam Reed
6c1273bc7d Fill in missing params from a dieUsage
Braces

Fixup parameter documentation
2010-09-25 16:45:41 +00:00
Sam Reed
f07567201f Remove some unused variables
Tweak php doc, "One" is not a type, so insert string in there
2010-09-25 16:37:39 +00:00
Sam Reed
ee04d754ed Only display Examples section if it's got anything in the array 2010-09-03 22:58:09 +00:00
Sam Reed
fc38716f49 ApiBase.php:
"Don't show No more than 500 ( for bots) allowed" when MAX2 isn't set

Trim trailing whitespace from Database.php
2010-08-31 21:06:01 +00:00
Sam Reed
5d383466e1 Minor followup to r70480
Only throw missingparam for string === '' when it is required

RELEASE-NOTES for breaking change
2010-08-19 14:54:09 +00:00
Platonides
50e2405a03 Refactor to avoid defining globals inside switches. 2010-08-12 14:25:07 +00:00
Alexandre Emsenhuber
457eb73b61 Standardised file description headers, added @file 2010-08-07 19:59:42 +00:00
Sam Reed
7128c455cc Followup r69091 Where did those spaces come from? :/ 2010-08-05 07:08:06 +00:00
Sam Reed
ddc7efbedf stylize api up to date 2010-08-05 07:02:09 +00:00
Sam Reed
c85b04919e Revert r70489 2010-08-05 06:58:11 +00:00
Sam Reed
0345d5e08f Move if ( is_array( $value ) && !$dupes ) { up to else block after the first !is_array. If it's not not an array, it's an array, and therefore, we can just filter dupes if requested 2010-08-05 06:08:23 +00:00
Sam Reed
c95f4a05ad Followup r70480, per Nikerabbits comment, there '''is''' something to do 2010-08-05 06:02:57 +00:00
Sam Reed
0ccf248381 -rakkaus/#mediawiki-i18n- [04-Aug-2010 22:02:04] PHP Notice: Undefined variable: required in /www/w/includes/api/ApiBase.php on line 749 2010-08-04 22:02:57 +00:00
Sam Reed
edf926dfe2 Followup r70479
If string is required, but it's value === '', that's missing!
2010-08-04 21:21:35 +00:00
Sam Reed
b70c52dd8e Further followup to r70460/r70461 and r70477
Move code into getParameterFromSettings, most of the flesh is there anyway (it checks isset( $value ) ), so we can use the else to check if it's required

A followup could be to whinge if '' is returned for a string
2010-08-04 21:19:53 +00:00
Sam Reed
dd889d04c4 Followup r70460/r70461
use self consistently

Fold in duplicate loop

missingparam can be done during attempt to set ParamCache, we might aswell give up and not finish populating the param cache if we're gonna die from a missing param
2010-08-04 20:27:56 +00:00
Sam Reed
f77fff0ffb Followup r70461 if PARAM_REQUIRED is set, use for missing param in getPossibleErrors in ApiBase
All but ApiQueryBacklinks
2010-08-04 19:20:15 +00:00
X!
8b466d3d0d Followup to r70460: Committed wrong version of ApiBase.php, convert all core API modules to PARAM_REQUIRED syntax 2010-08-04 14:15:33 +00:00
X!
20d042a99e * PARAM_REQUIRED parameter flag added. If this flag is set, and the end user does not set
the parameter, the API will automatically throw an error.
2010-08-04 13:35:08 +00:00
Bryan Tong Minh
0e61296f98 (bug 24564) Fix fatal errors when using list=deletedrevs, prop=revisions or one of the backlinks generators with limit=max. 2010-07-28 11:30:14 +00:00
Tim Starling
6afbc6762c Reintroduced the extractRequestParams() memoization as in r69782, but respecting $parseLimit. Fixes bug 24564 (fatal error due to duplicate calls to addValue()). 2010-07-28 04:12:36 +00:00
Tim Starling
287c9ea4f5 Partial revert of r69782: reverted the cache feature, it does not correctly respect $parseLimit. 2010-07-26 06:20:29 +00:00
Platonides
5833c105d0 Move getValidNamespaces() to Namespace.php 2010-07-25 22:29:05 +00:00
Roan Kattouw
075c8d1624 Followup to r69776: cache result of extractRequestParams() because it gets called 2 or 3 times per module per request now. Also touch up documentation here and there 2010-07-23 10:15:29 +00:00
Sam Reed
5387b8a806 Stylize API up to date
Fix spaces from r69755

Minor update to RELEASE-NOTES per r69753
2010-07-23 07:33:40 +00:00
Tim Starling
b2dc451c82 Rewrote r69339 etc. to clean up API cache header handling.
* Introduced a "cache mode" concept to simplify the header generation code, and to avoid odd results when conflicting cache header requests are received from submodules, or at least to formalise the handling of such cases.
* Made the cache mode private by default, so that code written in ignorance of caching tends to be safe. If different query modules are used in a single request, private caching is preferred over public caching.
* Removed the "must-revalidate" option from all CC headers, this is really specific to page views with a hacked squid in front, I don't think it's applicable here.
* Made the watchlist module private. This is really the definition of private data. There's nothing in the HTTP spec that says the URL for a CC:public request is private and can't be leaked. CC:private provides protection against unknown proxy behaviour.
* In ApiQueryAllmessages: avoid calling $wgLang->getCode() to check if it's necessary to make a new $wgLang when lang= is specified, since this is the only thing that unstubs $wgUser.
* Removed "FIXME: should this check $user instead of $wgUser?" Answer is no.
2010-07-23 07:17:56 +00:00
Sam Reed
8f1d2cb199 Big blitz on unused variables (a lot of $db = $this->getDb() ) 2010-07-22 22:13:21 +00:00