Commit graph

22 commits

Author SHA1 Message Date
Aaron Schulz
91094ea42d Fix check against wrong permission (should be 'hideuser') 2009-03-09 10:01:00 +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
a7223d80bc API: (bug 16367) Add allowusertalk attribute to list=blocks output 2008-11-18 15:11:11 +00:00
Aaron Schulz
3337669b0c * Fix comment
* Rename HexToIP -> HexToQuad
2008-11-02 18:35:58 +00:00
Roan Kattouw
db6d1ed1dc API: Move ApiQueryBlocks::convertHexIP() to IP::hexToIP() per Werdna's comment on r43040 2008-11-02 16:50:59 +00:00
Roan Kattouw
0ea1d6ea9c API: Followup on r43014: clean up some more 2008-11-01 22:19:39 +00:00
Roan Kattouw
36174d19cb API: Clean up ApiQueryBlocks, which was a stylistic mess. I can't believe I actually wrote that code (I was young and foolish, I guess :P ) 2008-11-01 19:23:14 +00:00
Tim Starling
b47bb18aad Fixed more wfGetDB() calls with no arguments. 2008-09-21 09:15:28 +00:00
Roan Kattouw
050e1c7380 Cleanup from r37839: just put ipb_auto in the relevant arrays. We have those arrays so we don't have to add if($fld_a || $fld_b) for every crazy flag combination in existence. 2008-07-21 21:37:11 +00:00
Brion Vibber
81f62b9ff8 Security fix for API blocks query -- ipb_anon field wasn't being loaded when querying for usernames but not flags, but this field is needed to tell whether a given row is an autoblock and needs the IP suppressed. 2008-07-19 07:50:14 +00:00
Roan Kattouw
c6bf702b93 API: Added bkip parameter to list=blocks. This more than fixes bug 14405.
About the database query: I know it filesorts the result set, but that shouldn't cause any trouble as the result set is always small. To be more specific: it cannot be larger than 17 rows. This is because bkip=foo only grabs (range) blocks that contain foo *in its entirety*. Therefore, in the worst case foo is a single IP and the result set will consist of a single block, a /31 range block, a /30, etc. to /16 (blocks that cross /16 , which adds up to 17 blocks (note that there's only one /N range that a /N+K range is part of).
2008-06-19 13:43:14 +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
Roan Kattouw
cb77d12c70 API: Fixed handling of usernames containing spaces in list=block 2008-04-26 14:09:16 +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
Aaron Schulz
15863d5b2d Use 'suppress' right rather than 'oversight' 2008-04-01 22:50:53 +00:00
Roan Kattouw
d6336cd44e (Bug 13175) Added example for list=blocks 2008-02-28 13:32:10 +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
Victor Vasiliev
a5ea966feb * (bug 12321) API list=blocks reveals private data 2007-12-16 08:59:47 +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
Victor Vasiliev
88c6568f2b Fix svn:eol-style and svn:keywords for files from merged APIEdit branch 2007-12-06 16:06:22 +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