Commit graph

316 commits

Author SHA1 Message Date
Reedy
2bfd84eb8c Duplicate array keys aren't going to do very much...
Change-Id: I3421f70332f9514e71d4c1f0751be567108c1099
2012-04-05 19:35:09 +01:00
umherirrender
1788cc76c5 (bug 31883) Limit of some params is not documented in API autodoc
Original bug description: Limit of bkusers of list=blocks and titles of
action=query is not documented in API help

For that params no PARAM_TYPE was set, determine the type with the same
code as in r85758 (action=paraminfo) and its modification in r86917

Move the adding of that text out of the else, than the doc is also
added to params with more than 50 default values
(which looks to be intend of that piece of code).

Change-Id: I3fa59d2a7ae688da79dab57dc0576a69f786cca5
2012-04-03 14:58:44 +02:00
Liangent
fc072f2dfc Was causing Notice: Array to string conversion in .../includes/api/ApiBase.php on line 285 and examples of list=allimages are not displayed properly
Change-Id: I4fde14245ac19716957beb634a274c3a6042d776
2012-03-26 21:36:24 +08:00
Ryan Kaldari
71bdf4a745 better error message and comment 2012-03-08 00:34:42 +00:00
Roan Kattouw
14b9e780c2 It seems that parseMsg() sometimes receives strings, probably from bad dieUsageMsg() callers or badly formatter error arrays. I don't want to have to track this down, so I'm making it fail gracefully and just cast any strings to arrays 2012-03-07 02:09:22 +00:00
Niklas Laxström
53317d179b Added @since annotations 2012-02-26 14:16:53 +00:00
Sam Reed
1374c143a6 Improve documentation 2012-02-24 18:38:04 +00:00
Sam Reed
b834075972 * (bug 32341) Add upload by URL domain limitation.
Essentially reverts r109741  live again

Which was r109562, r109564, r109570
2012-02-09 23:22:38 +00:00
Sam Reed
138ddc452f Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 17:42:35 +00:00
Sam Reed
b7d68a8716 Documentation and whitespace 2012-02-09 01:06:57 +00:00
Sam Reed
af198296ef Revert feature out of r109562, r109564, r109570
Leaving typo/brace fixes and other minor code improvements
2012-01-22 17:33:44 +00:00
Sam Reed
f619564720 * (bug 32341) Add upload by URL domain limitation. 2012-01-19 19:16:06 +00:00
Sam Reed
81ef87f61a * (bug 33733) API: Unknown error: mustbeloggedin
Add message to messagemap
2012-01-14 23:45:21 +00:00
Niklas Laxström
8522618068 Ping r108847, missed one half quote 2012-01-13 21:19:44 +00:00
Siebrand Mazeland
1033737a05 Change usage of quotes in API messages from ``x'' to "x". 2012-01-13 21:11:27 +00:00
John Du Hart
f423134ac7 Missing check for ISMULTI on help parameters, thanks santhosh 2012-01-03 11:05:55 +00:00
John Du Hart
ef616c24b0 Bug 33482 - Api incorrectly calls ApiBase::parseMultiValue if allowed values is given as an array
Simply means that if you have an array of acceptable values and you only accept one at a time, you can have pipes in the allowed values.
2012-01-03 11:02:26 +00:00
Sam Reed
4024f986bd Followup r107393, treat '' the same as getting false from getExamples, the default if it's not overridden 2011-12-31 00:22:37 +00:00
Sam Reed
6115b93df8 Re-instate most of the revisions for bug 33147 "API examples should explain what they do"
Using this to sync up my working copies

Should have the little niggles tidied up though
2011-12-27 16:22:35 +00:00
Brion Vibber
ad0d48d6bc Revert r106439, r106441 - bad formatting mushing separate lines together 2011-12-20 22:11:29 +00:00
Brion Vibber
adf5768359 Revert r106870: doesn't seem like it would format things consistently as expected. 2011-12-20 22:05:40 +00:00
Sam Reed
b956a8eb19 For r106521/r106865, wrap long example description strings
Follows up r106439
2011-12-20 21:37:51 +00:00
Sam Reed
6c80c5ff87 Prep work for * (bug 33147) API examples should explain what they do
Now formatted in the autogenerated documentation

Format for paraminfo adds a description attribute to output


query allimages descriptions are tranformed, need to do/add to other ones
2011-12-16 15:28:35 +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
7ea2f68c3a Followup r105823, make it protected 2011-12-11 20:41:23 +00:00
Sam Reed
b8d83ec568 Adding a getDB function to ApiBase...
Not all subclasses will need/want it. It does however make it easier to pretend non ApiQuery derivatives actually are...
2011-12-11 20:32:37 +00:00
Sam Reed
7f3f1f7caf Followup r104441
Fix capitalisation mismatch
2011-11-28 19:17:06 +00:00
Sam Reed
53000baecf Oh noes, moar http:// -> https:// 2011-11-28 15:43:11 +00:00
Sam Reed
f3839fe71f Added "ApiGetDescription" hook 2011-11-28 15:33:28 +00:00
Roan Kattouw
792c38f424 (bug 26854) Invalid user names go unchecked. Applied most of the patch submitted by Søren Løvborg, checking for null return values from User::newFromName() 2011-11-20 10:55:58 +00:00
Alexandre Emsenhuber
2c4d6b6992 Follow-up r103332: fix "invalidoldimage" error message to say "oldimage" instead of "oldid" 2011-11-19 08:29:49 +00:00
Alexandre Emsenhuber
2bb8c2ea4d * Use WikiPage instead of Article
* Create the WikiPage object directly in execute() and pass it to both delete() and deleteFile()
* Reordered parameters of delete() and deleteFile() to be consistent and take both on the WikiPage and User objects (instead of relying on $wgUser); no callers outside of this class
* Fixed deleteFile() to match the behaviour of FileDeleteForm with oldimage parameter
* Pass the User object to getPermissionsError()
* Factorised duplicated code
* Added missing error code to ApiBase (and also a new one)
* Added missing possible error codes (with a new one too)
2011-11-16 15:57:56 +00:00
Roan Kattouw
71461de9de Followup r99224: add message to ApiBase::$messageMap too 2011-11-14 14:40:55 +00:00
Alexandre Emsenhuber
681523d5ad Fix for r100905:
* Make tests work again
* Added ApiTestCase::doApiRequest() and related to pass it to the context and removed override of $wgUser where possible
* Fix ApiLogin to get the correct User object (i.e. the logged in one)
* Fix ApiBase to feed a RequestContext to setContext() so that ApiLogin can call setUser()
2011-10-27 18:46:40 +00:00
Sam Reed
fa65fa3243 Documentation
Deprecated code updates
2011-10-27 00:46:17 +00:00
John Du Hart
24427ca1d8 Followup 100905, fixing usages of getContext() 2011-10-26 23:34:31 +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
Sam Reed
469cc76775 Return documentation 2011-09-21 16:36:43 +00:00
Jeroen De Dauw
328765afbc doc fix 2011-09-06 20:31:51 +00:00
Roan Kattouw
5090af900c (bug 29246) Edit API occasionally throws "unknown error 231". Per comment #1 on the bug and a comment in ApiEditPage, I refactored internalAttemptSave() to return a status object. However, there are so many idiosyncracies wrt how EditPage handles various errors that I decided to put the AS_* error code in $status->value (thanks Chad for that tip) and use that to decide what to do (not part of Chad's tip). The resulting code is still a mess but at least Status objects from doEdit() are propagated now, and it'll be a little bit easier to migrate internalAttemptSave() to a proper Status-based architecture in the future. Or maybe we should just throw away EditPage and start with a blank screen, that sounds appealing to me :) 2011-08-26 16:26:17 +00:00
Sam Reed
ac0ff8fb37 Followup r92396 rename method, fix boolean comparison that was supposed to be inverted when de-indenting 2011-07-17 16:23:29 +00:00
Sam Reed
d18c0dc315 * (bug 28817) Add reference help page link to API Modules
Start of this bug, fleshed out base code implemented, plus a few key modules (will finish rest up soon)

Tweaked/improved/updated some documentation as I went through also
2011-07-17 16:18:09 +00:00
Alexandre Emsenhuber
ffd52683c8 Create a new RequestContext to use its OutputPage and Skin members instead of messing with global ones 2011-07-08 16:18:31 +00:00
Sam Reed
8edf4a2d92 Fix trailing whitespace
Swap methods that call $this->getResult() to use temporary variable
2011-06-29 23:46:39 +00:00
Sam Reed
bdf84cb20e Swap else if for elseif
Trimming trailing whitespace also

Doing in 3 commits, so hopefully reviewable in CR...
2011-06-17 16:03:52 +00:00
Sam Reed
67df4ef4c0 * (bug 27716) Make a method to do checking of 0 or 1 of the parameters existence (like requireOnlyOneParameter), but without needing one of the parameters 2011-06-06 16:45:40 +00:00
Krinkle
2d03eedf8a WatchAction requires token (BREAKING CHANGE)
* (bug 27655) Require token for watching/unwatching pages
* Previously done for API (bug 29070) in r88522
* As with markpatrolled, the tokens are not compatible and made that way on purpose. The API requires the POST method and uses a universal token per-session. Since the front-end is all GET based (also per convention like in markpatrolled and rollback) they are stronger salted (title / action specific)
* ajax.watch used the API already and was switched in r88554.
* The actual watching/unwatching code was moved from WatchAction->onView to WatchAction::doWatch. This was done to allow the API to do the action without needing to generate a token like the front-end needs (or having to duplicate code). It is now similar to RecentChange::markPatrolled (in that it  also a "central" function that does not care about tokens, it's called after the token-handling)
* JavaScript / Gadgets that utilize action=watch in their scripts:
** Effects should be minimal as they should be using the API (see r88522 and wikitech-l)
** If they use index.php and scrap the link from the page, they can continue to do so.

* There are links to the watch action all over the place. I've tried to catch most of them, but there may be some I miss. Migration in most cases is just a matter of adding an array item to the $query for:
 'token' => WatchAction::getWatchToken( $title, $user [, $action] )
or changing:
 Action::factory( 'watch', $article )->execute();
to:
 WatchAction::doWatch( $title, $user );

While replacing the usages in some cases an instance of Article() no longer had to be created, in others $wgUser had to be retrieved from global (which was implied before but needs to be given directly now)

Other notes:
* Article->unwatch() and Article->watch(), which were deprecated as of 1.18 and are no longer used in core, may be broken in scenarios where the Request does not have a 'token' but is making a call to $article->watch()
* Some extensions need to be fixed, I'm currently running a grep search and will fix them a.s.a.p 


[1] http://www.mediawiki.org/wiki/ResourceLoader/Default_modules?mw.user#tokens
2011-06-06 00:09:03 +00:00
Sam Reed
587f480923 * (bug 28392) mark action=undelete&timestamps as type "timestamp"
Allow multiple timestamps
2011-06-05 23:18:22 +00:00
Sam Reed
58ccb663e1 Followup r89515, fix double spacing in API Error message
Add both customcssprotected and customjsprotected to the possible errors output for editpage
2011-06-05 18:34:26 +00:00
Sam Reed
5749cfa480 * (bug 21107) Split error "customcssjsprotected" into separate messages for JS and CSS 2011-06-05 18:29:43 +00:00