Commit graph

44 commits

Author SHA1 Message Date
Alexandre Emsenhuber
457eb73b61 Standardised file description headers, added @file 2010-08-07 19:59:42 +00:00
Sam Reed
dc360b4cef Change statsOutput to parent, wikiStatsOutput is a subclass of statsOutput 2010-08-06 14:12:41 +00:00
Sam Reed
6c2abce867 Make search enforced by API in search by setting PARAM_REQUIRED
Same for ApiQueryCategoryMembers and ApiWatch title params

More followup to r70461
2010-08-04 20:47:58 +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
2d21295243 * (bug 23473) - Give description of properties on all modules
Commit patch by John Du Hart with a few minor tweaks/fixes
2010-06-23 19:36:26 +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
Jack Phoenix
7fa78fefa9 API: fix copyright symbol, coding style cleanup, more braces 2010-02-24 14:00:23 +00:00
Sam Reed
d299fc6a55 Complete dieUsage errors in 7 more Api files 2010-02-13 01:21:52 +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
96af85cf1a (bug 19640) API: Unbreak cmnamespace in miser mode by filtering on the PHP side. This is a dirty, temporary hack that'll have to do until we can do this properly on the database side. 2009-07-15 10:07:02 +00:00
Alex Z
773a324f73 Followup to r53087 / r53052 - Change dieUsage to setWarning per CodeReview 2009-07-13 14:54:38 +00:00
Alex Z
20b9b18781 Followup to r53052 - Die if someone tries to use the namespace filter, rather than silently igoring it.
Add a note if its disabled in the param description
2009-07-10 23:46:13 +00:00
Domas Mituzas
84efd8a702 don't allow querying specific namespace if misermode is enabled 2009-07-10 13:55:48 +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
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
Alexandre Emsenhuber
0d0d7b5559 Per Catrope's request, commiting patch on bug 16017:
* (bug 16017) list=categorymembers sets invalid continue parameters for sortkeys containing pipes
2008-10-18 10:09:19 +00:00
Roan Kattouw
1be7d14726 * API: (bug 15995) Added cmstartsortkey and cmendsortkey parameters to list=categorymembers, mirroring cmstart and cmend for timestamps
* Drop useless and possibly filesorting ORDER BY cl_to from list=categorymembers
* Handle ORDER BY cl_sortkey, cl_from (possibly with DESC appended to each of them) with addWhereRange() calls
2008-10-17 14:26: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
Roan Kattouw
5ea924d9dc API:
* Fixed allcategories paging
* Removed DISTINCT from allcategories query (which only selects a UNIQUE field anyway)
* Improved categorymembers performance; it used to filesort
* Disabled cmstart and cmend for cmsort=sortkey to prevent filesorting
* Fixed categorymembers paging for cmdir=desc
2008-04-29 09:01:13 +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
20308a5abc (bug 13718) Return the proper continue parameter for cmsort=timestamp 2008-04-13 19:17:48 +00:00
Roan Kattouw
6bf0a72510 Partial revert of r32097: please don't introduce this hybrid behavior thing, it'll only confuse people (has been discussed before). Spending 9 bytes on "Category:" won't kill anyone and ensures consistency with iutitle 2008-03-18 14:59:44 +00:00
Victor Vasiliev
702839e060 * Use "title" instead of "category"
* Support both "Category:Test" and "Test" format
* Fix notice about undefined index
2008-03-18 08:14:08 +00:00
Roan Kattouw
471006c9cb API:
* Removing deprecated cmcategory parameter
* Correcting action=login help text
2008-03-16 19:08:30 +00:00
Roan Kattouw
a121bda026 (bug 12944) Filter categorymembers by timestamp 2008-02-07 15:17:42 +00:00
Roan Kattouw
2a13fafebd Consistency 2008-02-04 17:23:05 +00:00
Roan Kattouw
15c1a53295 (bug 12898) imageusage and categorymembers lack consistency 2008-02-04 16:58:51 +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
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
464e997a1f *(bug 11275) Enable descending sort in API categorymembers 2007-09-10 14:17:33 +00:00
Roan Kattouw
e58e384e93 Additional fix of bug 10890 2007-09-04 14:30:31 +00:00
Brion Vibber
5efbfbe9b4 Use 'enc' variable naming convention for interpolated pre-encoded variables in raw SQL strings. This'll keep your release manager from freaking out when he sees raw variables being dumped into raw SQL. 2007-09-04 14:25:55 +00:00
Roan Kattouw
4a61358db9 * (bug 10890) API: Timestamp support for categorymembers query
* Removed some stray whitespace
2007-09-03 20:37:42 +00:00
Yuri Astrakhan
8ca133afff API: Big change: Removed all userCanRead() checks per IRC discussion. Only rvprop=content will now check that the page can be read. 2007-07-14 19:04:31 +00:00
Yuri Astrakhan
9afb42f99c API:
* added link enumeration (list=alllinks)
* marked potential security vulnerability
2007-07-08 03:35:37 +00:00
Yuri Astrakhan
0c2ba7f8ad API: Fixed continuation bug in list=categorymembers. Thanks to Roberto Leandrini. 2007-07-06 19:43:32 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
Yuri Astrakhan
6f82fb146b API: Added categorymembers list ability. 2007-06-16 00:39:01 +00:00