Commit graph

96 commits

Author SHA1 Message Date
Aaron Schulz
5a6559d8b1 Reverted r108743 per CR comment. This should at least be discussed first. 2012-01-12 19:41:18 +00:00
Sam Reed
a5c200a25b Kill "* @return void" 2012-01-12 19:12:24 +00:00
Sam Reed
53000baecf Oh noes, moar http:// -> https:// 2011-11-28 15:43:11 +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
Sam Reed
a5628f5734 Based on diff to wikia, set more functions consistently public rather than protected 2011-08-17 22:24:21 +00:00
Sam Reed
9c37ab4fb3 * (bug 28817) Add reference help page link to API Modules
Last followup of r92396

Should be all modules with documentation pages in core now documented...
2011-07-17 17:02:06 +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
Alexandre Emsenhuber
dc4081528c Removed usage of error suppression operator 2011-05-17 18:03:50 +00:00
Bryan Tong Minh
2cc5f4e972 Kill the error suppression operator in the Api 2011-05-15 14:57:10 +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
fa64025161 More parameter documentation 2011-02-19 00:30:18 +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
Sam Reed
6309c920dd Delete all the "API for MediaWiki 1.8+" comments
Add since to ApiQueryQueryPage
2010-12-22 20:52:06 +00:00
Chad Horohoe
65871ee245 Cleanup r65183, fix ugly stylize.php formatting 2010-11-03 12:49:21 +00:00
Sam Reed
f1999bef69 extract is weird
Do what extract is doing explicitally
2010-09-25 17:01:17 +00:00
Alexandre Emsenhuber
457eb73b61 Standardised file description headers, added @file 2010-08-07 19:59:42 +00:00
Sam Reed
b76fb090a8 Followup r70474 and r70461, drop missingparam from getPossibleErrors 2010-08-04 19:32:23 +00:00
X!
1afd723c5b Followup to r70460 and r70461: Use true instead of 1 2010-08-04 14:29:39 +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
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
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
Sam Reed
3cb1d23890 Remove various unused parameters
Only comment them out in ApiFormatYaml_spyc.php
2010-07-22 21:55:40 +00:00
Derk-Jan Hartman
921619b119 Correct the address of the FSF in some of the GPL headers
59 Temple Place -> 51 Franklin Street
2010-06-21 13:13:32 +00:00
Sam Reed
faf34b4073 Per http://www.mediawiki.org/wiki/Special:Code/MediaWiki/66168#c7252 switch while ( $row = $db->fectchObject( $res ) ) to foreach ( $res as row )
On ApiQueryUsers switch $r to row, and remove nested brackets
2010-06-20 18:48:34 +00:00
Sam Reed
a90a0783de Nuke $db->freeResult() from Api stuffs 2010-06-20 17:48:21 +00:00
Sam Reed
e55ed729c4 Mixture of things.
Couple of class comments

Normalisation of "." usage at end of lines (removed)

Normalisation of {prefix}parameter as per bug 23461
2010-05-11 22:30:18 +00:00
Sam Reed
0769301e87 Stylize Api upto date 2010-04-17 20:58:04 +00:00
Jack Phoenix
96b4f302af API: fix copyright symbol, coding style cleanup, more braces 2010-02-24 13:34:11 +00:00
Sam Reed
9e44e9295d Fixup spaces to tabs from r62404 2010-02-14 14:29:24 +00:00
Sam Reed
6911358977 Complete dieUsage errors in 6 more Api files 2010-02-13 01:05:14 +00:00
Sam Reed
2081a0693f Rest of dieUsageMsg in getPossibleErrors 2010-02-13 00:28:27 +00:00
Sam Reed
8761fef623 Stylize.php on API 2010-01-31 21:21:46 +00:00
Roan Kattouw
39a50765c5 API: Document the behavior added in r61447 2010-01-24 10:10:00 +00:00
Sam Reed
ed02427598 minor followup to r61447, moving commment 2010-01-24 00:14:21 +00:00
Sam Reed
3f9621dfd1 * (bug 22245) blfilterredirect=nonredirects in blredirect mode wrongly filtering
If filterredir == 'nonredirects', only filter if !redirect
2010-01-23 23:32:15 +00:00
Sam Reed
b739e97341 More of r61437 (adding/removing whitespace) 2010-01-23 22:47:49 +00:00
Sam Reed
01e257cbd5 Normalise check for filterredir in Allpages to that of backlinks
Add a couple of blank lines
2010-01-23 21:28:27 +00:00
Sam Reed
9edf60de0f filterredir is mutually exclusive (one value)
Change 2nd if for else if in both 1st and 2nd queries
2010-01-23 21:25:25 +00:00
Aryeh Gregor
3758769f0d stylize.php on API code
"I wouldn't object to stylizing the API code to bring it in line with
the rest of MW on principle, but I'm not gonna bother myself." --Roan
<http://www.mediawiki.org/wiki/Special:Code/MediaWiki/60657#c5108>

If you're seeing this commit in blames, tell your blame tool to ignore
whitespace, e.g., git blame -w or svn blame -x -w.
2010-01-11 15:55:52 +00:00
Roan Kattouw
73560aeb2c API: Do a STRAIGHT_JOIN in ApiQueryBacklinks's first query to counter a MySQL 4 bug where the optmizer chooses to do a table scan on page instead. 2009-08-27 14:58:19 +00:00
Siebrand Mazeland
8e23949bee Proper casing for getDBkey() 2009-05-24 08:29:10 +00:00
Roan Kattouw
c3096d8ac6 API: (bug 18601) generator=backlinks returns invalid continue parameter. Patch by Brad Jorsch 2009-04-27 14:09:47 +00:00
Roan Kattouw
555f84e41a API: Change Image: to File: in examples 2009-03-09 10:44:34 +00:00
Roan Kattouw
88f35cdf6e API: Some cleanup
* Aggressively intval() numeric things; addresses the concerns raised on bug 11633
* Use ApiQueryBase::addTitleInfo() everywhere
* Remove a drug-induced-looking line from ApiQueryWatchlist.php
2009-02-27 16:03:01 +00:00
Roan Kattouw
b2503c70ab API: (bug 17563) Fix regression from r46845 that changed the output for list=backlinks to use page IDs as array indexes instead of 0,1,2,... (which makes a big difference in JSON and breaks clients) and caused weird output for generator=backlinks as well. Patch by Brad Jorsch 2009-02-19 21:24:28 +00:00
Roan Kattouw
2df33ff098 * API: BREAKING CHANGE: (bug 11430) Return fewer results than the limit in some cases to prevent running out of memory
* This means queries could possibly return fewer results than the limit and still set a query-continue
* Add iicontinue, rvcontinue, cicontinue, incontinue, amfrom to faciliate query-continue for these modules
* Implemented by blocking additions to the ApiResult object if they would make it too large
** Important things like query-continue values and warnings are exempt from this check
** RSS feeds and exported XML are also exempted (size-checking them would be too messy)
** Result size is checked against $wgAPIMaxResultSize, which defaults to 8 MB

For those who really care, per-file details follow:

ApiResult.php:
* Introduced ApiResult::$mSize which keeps track of the result size.
* Introduced ApiResult::size() which calculates an array's size
  (which is the sum of the strlen()s of its elements).
* ApiResult::addValue() now checks that the result size stays below
  $wgAPIMaxResultSize. If the item won't fit, it won't be added and addValue()
  will return false. Callers should check the return value and set a
  query-continue if it's false.
* Closed the back door that is ApiResult::getData(): callers can't manipulate
  the data array directly anymore so they can't bypass the result size limit.
* Added ApiResult::setIndexedTagName_internal() which will call
  setIndexedTagName() on an array already in the result. This is needed for the
  'new' order of adding results, which means addValue()ing one result at a time
  until you hit the limit or run out, then calling this function to set the tag
  name.
* Added ApiResult::disableSizeCheck() and enableSizeCheck() which disable and
  enable size checking in addValue(). This is used for stuff like query-continue
  elements and warnings which shouldn't count towards the result size.
* Added ApiResult::unsetValue() which removes an element from the result and
  decreases $mSize.

ApiBase.php:
* Like ApiResult::getData(), ApiBase::getResultData() no longer returns a
  reference.
* Use ApiResult::disableSizeCheck() in ApiBase::setWarning()

ApiQueryBase.php:
* Added ApiQueryBase::addPageSubItem(), which adds page subitems one item
  at a time.
* addPageSubItem() and addPageSubItems() now return whether the subitem
  fit in the result.
* Use ApiResult::disableSizeCheck() in setContinueEnumParameter()

ApiMain.php:
* Use ApiResult::disableSizeCheck() in ApiMain::substituteResultWithError()
* Use getParameter() rather than $mRequest to obtain requestid

DefaultSettings.php:
* Added $wgAPIMaxResultSize, with a default value of 8 MB

ApiQuery*.php:
* Added results one at a time, and set a query-continue if the result is full.

ApiQueryLangLinks.php and friends:
* Migrated from addPageSubItems() to addPageSubItem(). This eliminates the
  need for $lastId.

ApiQueryAllLinks.php, ApiQueryWatchlist.php, ApiQueryAllimages.php, ApiQuerySearch.php:
* Renamed $data to something more appropriate ($pageids, $ids or $titles)

ApiQuerySiteinfo.php:
* Abuse siprop as a query-continue parameter and set it to all props that
  couldn't be processed.

ApiQueryRandom.php:
* Doesn't do continuations, because the result is supposed to be random.
* Be smart enough to not run the second query if the results of the first
  didn't fit.

ApiQueryImageInfo.php, ApiQueryRevisions.php, ApiQueryCategoryInfo.php, ApiQueryInfo.php:
* Added continue parameter which basically skips the first so many items

ApiQueryBacklinks.php:
* Throw the result in a big array first and addValue() that one element at a time if necessary
** This is necessary because the results aren't retrieved in order
* Introduced $this->pageMap to map namespace and title to page ID
* Rewritten extractRowInfo() and extractRedirRowInfo() a little
* Declared all private member variables explicitly

ApiQueryDeletedrevs.php:
* Use a pagemap just like in Backlinks
* Introduce fake page IDs and keep track of them so we know where to add what
** This doesn't change the output format, because the fake page IDs start at 0 and are consecutive

ApiQueryAllmessages.php:
* Add amfrom to facilitate query-continue

ApiQueryUsers.php:
* Rewrite: put the getOtherUsersInfo() code in execute()
2009-02-05 14:30:59 +00:00
Roan Kattouw
37ebf53907 Explain why this code doesn't use LinkBatch. 2009-01-24 13:10:30 +00:00
Roan Kattouw
32042c271f API: (bug 16483) Kill filesort in ApiQueryBacklinks caused by missing parentheses. Building query properly now using makeList() 2009-01-24 13:00:43 +00:00
Bryan Tong Minh
24a930a13e Force the use of the PRIMARY key rather than the name_title in the second query. 2009-01-08 22:02:16 +00:00