Commit graph

71 commits

Author SHA1 Message Date
Roan Kattouw
dd67a0917b API: Clarify help text for cmstartsortkey and cmendsortkey parameters 2011-04-19 15:46:05 +00:00
Roan Kattouw
8cc843f25c API: BREAKING CHANGE: (bug 28541) Output of binary ICU sortkeys is broken. Change sortkey fields in prop=categories and list=categorymembers to hexadecimal strings, that way we don't have any issues with scary binary stuff. Also change cmcontinue to take hex-encoded sortkeys and swap the order back to normal (previously sortkey was at the end because it could contain pipe characters, but that's not an issue with hex). 2011-04-17 12:41:29 +00:00
Roan Kattouw
f212ddabae BREAKING CHANGE: Ignore cmtype when cmsort=timestamp is set, and bypass the per-type queries in the sort=timestamp case; they were causing performance problems, reported as bug 28291. This breaks backwards compatibility (gracefully, the cltype parameter is silently ignored) with earlier deployed versions of 1.17wmf1 but not with any released version, hence no RELEASE-NOTES 2011-03-28 15:01:20 +00:00
Roan Kattouw
a6c758a39a Per r83812 CR, solve the categorymembers paging problem by doing separate queries for each value of cl_type, with some trickery to make paging work. This makes the enum->varchar schema change for cl_type unnecessary, so I'll revert that.
Code was largely copied from Tim's CR comment on r83812 but adapted to deal with the fact that we have to apply the cmcontinue-induced WHERE on cl_sortkey and cl_from only for the first query. Because ApiQueryBase doesn't let us unset or overwrite conditions like these in a nice way, I added an $extraQuery parameter to ApiQueryBase::select() that excepts additional query parameters that are only applied to that query but not stored in the object.
2011-03-20 16:25:01 +00:00
Sam Reed
3e725a90b8 Revert r83993 2011-03-16 00:13:10 +00:00
Marcin Cieślak
274d317a0c r83812, r83814: Don't use cl_type at all when paging categorylinks
* Remove cl_type from paging in categorylinks - it's not
  really needed there. Although cl_type is in WHERE but not
  in ORDER BY clause the worst thing that can happen
  is to have a filesort going again through <500 entries
  selected by index. Or will FORCE INDEX work anyway?

* Revert schema change, as we don't need cl_type there
  anyway (or even if we wanted to compare, it should
  work as expected by using INT values against ENUM).
2011-03-15 02:53:00 +00:00
Sam Reed
ec65ff0c11 Fixup a couple more hardcoded module prefixes in help 2011-03-13 17:28:53 +00:00
Sam Reed
92cad959dc Minor followup to r83814, also fix some other existances
Don't hardcode module prefixes (just incase they're subclassed at somepoint... :) )
2011-03-13 17:26:29 +00:00
Roan Kattouw
64d9832d1f (bug 27965) Paging in list=categorymembers was completely broken. It was paging by cl_from alone, while the index is on (cl_to, cl_type, cl_sortkey, cl_from) and only cl_to is constant. Fixed by paging on (type, sortkey, from), but using type|from|sortkey for clcontinue so any pipe characters in the sortkey are easier to handle. This needs the schema change in r83812 to work correctly, otherwise rows with cl_type=file will be skipped in certain cases. 2011-03-13 10:39:57 +00:00
Sam Reed
f483892c90 * (bug 27717) API's exturlusage module does not respect $wgMiserMode
Implement ApiQueryCategoryMembers style miser mode stuffs
2011-03-06 19:15:07 +00:00
Sam Reed
41e7860130 Implement getRequireOnlyOneParameterErrorMessages, to make the error messages requireOnlyOneParameter can throw.
Use in 4 modules for more dynamicness
2011-02-25 19:09:39 +00:00
Sam Reed
fa64025161 More parameter documentation 2011-02-19 00:30:18 +00:00
Roan Kattouw
e94830540e Various fixes for API category changes:
* Followup r80326: clarify description of type property
* Fix r80355: need to use addWhereRange() for the static ORDER BY on cl_type as well, to make sure it flips direction when needed (mixed-direction multi-field ORDER BYs are not indexed)
* Followup r80358: use current not previous value for cl_from, and use >= instead of > . This is the way continues are normally done
* Followup r80362: clarify description for sortkeyprefix property
2011-01-19 00:13:20 +00:00
Sam Reed
44d605d5c3 Fix spaes from r80362 2011-01-15 00:50:48 +00:00
Sam Reed
610c943cd2 Last bits of bug 24650 Fix API to work with categorylinks changes
Allow optional output of cl_sortkey_prefix (will anyone needed it, no idea)
2011-01-15 00:10:57 +00:00
Sam Reed
569b833ad2 More for bug 24650. Update continue to be usable unique thing 2011-01-15 00:00:25 +00:00
Sam Reed
4106d51063 Bye bye filesorts. Making order by cl_type, and then addWhereRange adds cl_sortkey, cl_from to this ORDER BY 2011-01-14 23:45:20 +00:00
Sam Reed
bbd8f041a5 Bleh, didn't press save again (r80350) 2011-01-14 23:24:25 +00:00
Sam Reed
82aaf647cb More query reorganisation, in an attempt to be index friendly 2011-01-14 23:20:42 +00:00
Sam Reed
d89ed3f20b Fix indenting, rearrange some where statements 2011-01-14 22:37:12 +00:00
Sam Reed
d6c5ef7a5d Remove ancient comment, collapse if, move USE INDEX into if further down doing the exact same 2011-01-14 21:24:42 +00:00
Sam Reed
cab22980ed Followup r80324, add type property description 2011-01-14 21:15:12 +00:00
Sam Reed
cd98ba161a Start of bug 24650 Fix API to work with categorylinks changes
Addition of a type field for filtering (default is "all" ie no filter)

Adding of type to props, to allow it to be outputted
2011-01-14 21:08:08 +00:00
Sam Reed
393f9bceb2 Remove one invalid errors, add 2 that could be returned 2011-01-07 02:29:31 +00:00
Sam Reed
5885c02a1a * (bug 26460) Add support for listing category members by category pageid 2011-01-04 23:59:39 +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
Roan Kattouw
b81ac8ea52 Improve some of the descriptions added in r68482 2010-12-14 11:47:13 +00:00
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