Commit graph

105 commits

Author SHA1 Message Date
Jack Phoenix
96b4f302af API: fix copyright symbol, coding style cleanup, more braces 2010-02-24 13:34:11 +00:00
Sam Reed
1f9a7d791c Implement 9 modules dieUsage errors 2010-02-13 00:48:31 +00:00
Mark A. Hershberger
8b36a2b969 various eol whitespace now instead of when someone needs to do CR 2010-02-12 06:44:16 +00:00
Sam Reed
b15f2c8c46 Normalise comment usage (# --> //) 2010-01-23 22:52:40 +00:00
Sam Reed
b739e97341 More of r61437 (adding/removing whitespace) 2010-01-23 22:47:49 +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
Tim Starling
bd8fffe24d Reverted r58646 as per my comments on bug 20554. 2009-12-01 01:55:04 +00:00
Roan Kattouw
1b89cd274a API: (bug 20554) Expose average slave lag (avglag) as well as maxlag. Patch by Sam Reed. 2009-11-06 14:38:55 +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
Bryan Tong Minh
95e16a5837 Revert r53678, r53704, r53705, r53773, r53930, r54199, r54201: Addition of ApiQueryBrokenRedirects and ApiQueryDoubleRedirects.
This is pure code duplication and should be done by fetching data from the respective query pages. This has as advantage that other query pages can be readily added to the API as well. See the querypage-work branch.
2009-08-03 11:06:24 +00:00
Alex Shih-Han Lin
78bb312b86 forget to shutdown classes in ApiQuery.php 2009-08-02 12:29:42 +00:00
Alex Shih-Han Lin
f1dc78ac2d +Add BrokenRedirects and DoubleRedirects API script for bot development. 2009-07-23 16:25:31 +00:00
Roan Kattouw
562dfb5de4 Revert r53147, r53149 and r53163 ("Add API module for QueryPage-based special pages"): this has already been worked on more extensively and cleanly in the querypage-work branch, if you wanna work on this please finalize the implementation there rather than reinventing the wheel. 2009-07-13 12:40:19 +00:00
Bryan Tong Minh
cb7471a46e (bug 14869) Allow access to QueryPage-based special pages via API
Only brokenredirects for now, until I find out which other special pages are suitable.
2009-07-12 21:51:47 +00:00
Roan Kattouw
902cc71973 * API: Really fix bug 17673 this time: exportnowrap still returned fatal errors when no titles were given or generated
* Move export/exportnowrap handling code out of the if(count($pages)) branch
* Add an error fallback to ApiFormatRaw (exportnowrap uses the XML formatter for errors), since Raw doesn't know how to format errors
2009-03-20 11:40:54 +00:00
Chad Horohoe
21bb5ca6d6 (bug 17871) Mention that exportnowrap format is the same as Special:Export. 2009-03-11 13:35:19 +00:00
Roan Kattouw
cb5fedd467 API: (bug 17873) Mention the 'g' prefix for generator parameters in the api.php help 2009-03-09 10:36:48 +00:00
Roan Kattouw
88075a3178 API: (bug 17673) Using &exportnowrap without &export results in an internal error 2009-02-26 10:11:53 +00:00
Roan Kattouw
8fc08c1869 API: (bug 16740) Adding list=protectedtitles to list create-protected titles 2009-02-13 21:34:46 +00:00
Roan Kattouw
7526c937c7 API: More docs, break long lines in docs 2009-02-13 14:13:03 +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
18eb32ec29 API: Tweak the format for &export to be more XML-friendly. Not a breaking change since &export hasn't gone live yet anyway 2009-02-04 22:12:25 +00:00
Roan Kattouw
5e5684ec77 * API: (bug 17007) Add export functionality to the API
* Accessed through the export and exportnowrap parameters added to action=query
* To facilitate &exportnowrap, add ApiFormatRaw, a formatter that just spits out its input without any formatting (not accessible through &format= of course)
* Fix up the action=query description message to reflect the deprecation of query.php
2009-02-02 20:07:33 +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
5c4efbf944 (bug 15768) Add list=watchlistraw to the API 2008-10-04 13:33:44 +00:00
Roan Kattouw
f7748d570b (bug 15653) Add prop=duplicatefiles to the API 2008-09-27 11:42:28 +00:00
Roan Kattouw
b62ddd3971 API:
* Title::moveTo() has been returning a getUserPermissionsErrors()-like array for ages now, let's use it correctly in ApiMove and skip the double-checks
* Remove some outdated TODO/FIXME comments
2008-09-25 21:39:36 +00:00
Roan Kattouw
3b86e96992 Do it right this time 2008-09-25 20:47:47 +00:00
Roan Kattouw
3ed4a18c6e API: Fix adding over prop/list/meta modules, which seems to have been broken for a long time without anyone noticing. 2008-09-25 20:46:24 +00:00
Roan Kattouw
353345d6ab API: Adding APIAfterExecute, APIQueryAfterExecute and APIQueryGeneratorAfterExecute hooks to make extending core modules possible in a cleaner way 2008-09-17 18:49:22 +00:00
Roan Kattouw
8ca02215a8 API: Fixing an E_NOTICE reported by Wikia. Can't reproduce locally, but an extra @ can't hurt. 2008-08-16 20:52:56 +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
4c675901ff Use 'api' querygroup 2008-05-13 21:04:24 +00:00
Roan Kattouw
80da31e04c (bug 13735) Added prop=categoryinfo module 2008-04-26 15:30:27 +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
Bryan Tong Minh
9c03862fbd (bug 11633) Explicitly convert redirect titles to strings due to PHP's very weak typing on array keys. 2008-04-05 18:34:10 +00:00
Roan Kattouw
16c8552437 (bug 13390) Invalid title no longer kills an entire API query 2008-03-18 15:17:24 +00:00
Victor Vasiliev
4b9f91999e * Introduced list=allimages
* (bug 13371) Build page set from image hashes
* Mark non-existent messages in meta=allmessages as missing
2008-03-17 08:25:22 +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
Roan Kattouw
1b691f504b (bug 12816) Adding list=random module which fetches a list of random pages. Based on a patch by Brent G. 2008-01-28 13:56:20 +00:00
Roan Kattouw
a81bd8ad8f API: Splitting of uiuser part of meta=userinfo to list=users, as discussed on the API list. 2008-01-27 20:28:36 +00:00
Roan Kattouw
8a0e46d97c API:
* Fixing buggy class instantiation in ApiParamInfo
* Adding getModules() method to ApiMain and ApiQuery
2008-01-23 18:40:40 +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
Roan Kattouw
730bad3fb1 APIEDIT BRANCH MERGE: Adding apiedit modules: action={block,changerights,delete,move,protect,rollback,unblock,undelete} and list={blocks,deletedrevs}. $wgEnableWriteAPI must be explicitly set to enable these modules. 2007-12-02 14:24:07 +00:00
Victor Vasiliev
3cc53e8ff2 API: add meta=allmessages 2007-12-01 17:04:13 +00:00
Roan Kattouw
4895ce631f Revert part of Brion's 27627: please don't throw away the child (maxlag) with the bathwater (format=raw) 2007-11-19 15:57:58 +00:00