Commit graph

106 commits

Author SHA1 Message Date
Sam Reed
c5ad4b031f bug 18427 - Parsed comment on prop=revision 2010-01-31 20:59:50 +00:00
Sam Reed
abe67e2523 ParamDescriptions for ApiQueryRevisions were inconsistently starting with upper and lower case.
Normalise to Upper case (as per rest of API)
2010-01-31 19:46:23 +00:00
Tim Starling
0319924c58 Fix careless errors in r61442 and r61444. 2010-01-29 00:51:08 +00:00
Sam Reed
b15f2c8c46 Normalise comment usage (# --> //) 2010-01-23 22:52:40 +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
8cceca66db API: Add rvdifftotext parameter to prop=revisions to allow diffing to a fixed text instead of a revision 2009-12-09 18:34:32 +00:00
Roan Kattouw
fc92a38146 Redo r58410, r58411 (attempts to to fix r58399) properly: isset vs. !is_null wasn't the problem, it's that the 'tag' parameter wasn't in the parameter list. 2009-11-02 08:29:26 +00:00
Alexandre Emsenhuber
cf29f11285 Fix for r58410: isset already checks for null, no need to do a double check :) 2009-11-01 21:54:25 +00:00
Siebrand Mazeland
e9f61edfa4 Should fix Undefined index: tag in includes/api/ApiQueryRevisions.php on line 152 from r58399. 2009-11-01 21:49:24 +00:00
Roan Kattouw
1d471caa46 API: (bug 19004) Add support for tags. Patch by Matthew Britton 2009-11-01 10:42:41 +00:00
Brion Vibber
8919302663 Revert r54291 "(bug 19004) Added support for tags to the API. Patch by Matthew Britton."
Per notes on code review, this doesn't handle multiple tags correctly right now.
2009-08-19 17:34:08 +00:00
Bryan Tong Minh
1ac223539e (bug 19004) Added support for tags to the API. Patch by Matthew Britton. 2009-08-03 17:48:01 +00:00
Jure Kajzer
c3fafd96f7 Added bitwise operations to DatabaseBase and overloaded in DatabaseOracle. 2009-06-13 06:31:38 +00:00
Roan Kattouw
7885c3d4e1 Fix E_STRICT reported on Translatewiki.net 2009-05-12 14:15:08 +00:00
Roan Kattouw
c1cb8854ee API: Add parentid (rev_parent_id) to prop=revisions output, as requested by Luca 2009-04-13 10:48:11 +00:00
Domas Mituzas
7071205057 Every time someone relies on equality propagation, god kills a kitten 2009-03-20 20:21:38 +00:00
Roan Kattouw
24b290b453 Followup to r48122: missed one 2009-03-07 13:13:27 +00:00
Roan Kattouw
5349ea2dd8 * API: (bug 13209) Add rvdiffto parameter to prop=revisions
* Add $wgAPIMaxUncachedDiffs (default 1) which controls how many non-cached diffs will be served per request
* Tweak DifferenceEngine.php a bit to make cache status accessible, and remove a useless 'parseinline' which broke diff generation in the API
2009-02-28 13:25:21 +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
48ae7ab6ff * API: (bug 17529) rvend ignored when rvstartid is specified
* To fix this, make the prop=revisions query slightly less performance-zealous and allow WHERE rev_timestamp <= 'foo' when sorting and rangescanning by rev_id
* Make adding ORDER BY in ApiQueryBase::addWhereRange() optional
* Move a RELEASE-NOTES entry to the right section
2009-02-18 15:26:09 +00:00
Roan Kattouw
6145465e34 API: Page prop=revisions by rev_id or (rev_page, rev_id), depending on mode, because the offset system potentially sucks. Suggested by Brad Jorsch 2009-02-10 12:32:22 +00:00
Roan Kattouw
4e67c4bdee Fix some more regressions from r46845 reported by Brad Jorsch on the mediawiki-api list <http://lists.wikimedia.org/pipermail/mediawiki-api/2009-February/000924.html> 2009-02-09 13:28:12 +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
167d11a8c3 * API: Listing (semi-)deleted revisions and log entries (with rev_/log_deleted != 0) as well in prop=revisions and list=logevents, with commenthidden/userhidden/actionhidden/texthidden flags where appropriate
* Still honors the paranoia checks added in r46807
* Use $index consistently in ApiQueryLogEvents
* Some whitespace consistency
2009-02-05 11:44:10 +00:00
Roan Kattouw
8504bf43e2 API: Crusade against extract(). Left one extract() call alone in ApiQueryBacklinks.php because I don't have a better alternative for it. 2008-12-17 16:34:01 +00:00
Roan Kattouw
d522ff9263 API: (bug 16516) Made rvsection=T-2 work rather than being interpreted as rvsection=0 2008-12-03 19:01:30 +00:00
Roan Kattouw
c8acd86afc API: (bug 16408) Added DOM tree generation (rvgeneratexml) to prop=revisions. Looks kind of ugly in XML, but bots don't care about that, and people should use less crappy-looking formats anyway. 2008-11-21 13:55:27 +00:00
Aaron Schulz
eef0d25777 Don't show orphaned revisions (will matter for bug 11402 later) 2008-10-29 04:17:31 +00:00
Tim Starling
f48c6070df Removed all instances of empty() where error suppression was not intended. Replaced with conversion to boolean, count() or empty string check as appropriate. Fixes a number of bugs due to incorrect conversion to boolean: suppressed edit summaries containing '0', ignored titles called '0', searches for '0' ignored, etc. 2008-10-25 14:04:43 +00:00
Roan Kattouw
6ad1e45cd9 API: * BREAKING CHANGE: (bug 16074) Providing prop=revisions&rvprop=content with too many titles or revisions (typically through a generator) no longer causes an error, but a warning
* Added ApiBase::truncateArray() and used it in ApiBase::parseMultiValue()
2008-10-24 13:05:44 +00:00
Roan Kattouw
bd3bf5d2a7 * Split patrol code
** Backend code moved to RecentChange::reallyMarkPatrolled() and doMarkPatrolled()
** Adapted Article::markpatrolled()
* (bug 15466) Added action=patrol to the API. Modified patch by Soxred93
* Added rctoken=patrol to list=recentchanges
* Detect duplicate warnings in ApiBase::setWarning()
2008-09-04 15:17:51 +00:00
Bryan Tong Minh
cb6b08b17b User::editToken expects the salt as an array, not as variable length argument list. 2008-07-08 08:42:27 +00:00
Tim Starling
fd1854de57 Fix silent failure in PHP 5.1.x or older. The callback for static functions is array('class', 'method'). 2008-07-07 07:57:24 +00:00
Roan Kattouw
07db2080a5 Fix regression from r37046: tokens should not be supplied when in JSON callback mode. Also remove ApiQueryBase::getTokenFlag() which is now obsolete. 2008-07-05 11:18:50 +00:00
Roan Kattouw
0104fa1f0c Rewritten the way the API handles tokens:
* Instead of hardcoding stuff all over the place, use callbacks
* Extensions can now add their own tokens to prop=info or prop=revisions using hooks
2008-07-04 12:07:02 +00:00
Alexandre Emsenhuber
087a9f70c5 WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>

Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage

One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
Aaron Schulz
bf63e619a6 Actually, page not always selected. Add this only when needed. 2008-05-13 20:02:25 +00:00
Aaron Schulz
ae152b63bf Actually specify page_id=rev_page to avoid cartesian join bringing the site down again 2008-05-13 19:58:12 +00:00
Roan Kattouw
22bab7ac08 $token is a parameter, so it's set by extractRequestParams() 2008-05-13 10:53:12 +00:00
Bryan Tong Minh
c316a2d6d3 ApiQueryRevisions now uses the Revision backend. This allows a more proper handling of rev_deleted. Also in case rev_size is filled on demand (bug 12188) there is only need to do this in one place. 2008-05-13 10:42:32 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Roan Kattouw
bfed011165 API: Added rvsection parameter to prop=revisions to allow fetching the content of a certain section only 2008-03-14 13:07:38 +00:00
Roan Kattouw
69653bd247 API: Fixing limit=max output; previous implementation threw fatal errors under certain conditions and didn't accomodate for some modules having different limits in some cases. 2008-02-25 14:12:55 +00:00
Roan Kattouw
19358606a1 API: Changing all modules' getParamDescription(), getAllowedParams() and getDescription() methods to public. ApiParamInfo needs them, and some versions of PHP threw fatal errors because they were protected. Oddly, other versions didn't (maybe because the caller and the callee have a common ancestor?) 2008-01-28 19:05:26 +00:00
Rotem Liss
9d02a8c560 Quick solution for problems with limit=max when using slow queries: allowing modules to delay the parsing of limit=max until they get the actual maximum values, and making them parse it by themselves. 2008-01-05 10:05:34 +00:00
Roan Kattouw
5d8f2177c5 API:
* Add list=allcategories module
* Fix token-related E_NOTICEs
2007-12-10 15:55:12 +00:00
Victor Vasiliev
0495f90ebb Revert r28215: incorrectly moved files 2007-12-06 18:33:18 +00:00
Victor Vasiliev
4e4cdf079e Create includes/api/query for Query API and includes/api/edit for Edit API 2007-12-06 18:22:15 +00:00
Daniel Cannon
7282f1a341 API: Standardize limits. Use ApiBase constants to avoid similar breakage and inconsistencies in the future. 2007-12-05 06:32:17 +00:00
Roan Kattouw
09149d5082 Reverting prop=revisions diff generation: way too expensive and DoS-vulnerable 2007-12-02 00:22:32 +00:00