Commit graph

110 commits

Author SHA1 Message Date
Brad Jorsch
f0a6435f3b API: Remove action=paraminfo 'props' and 'errors' result properties
The format for 'props' was never specified and the list for 'errors' is
impossible to keep updated when considering that many errors come from
MediaWiki backend code and extension hook functions. And since there
doesn't seem to be any real use case for either of these, let's just
kill both of them instead of wasting effort on trying to fix them.

Note that neither getResultProperties nor getPossibleErrors are called
from any extensions in gerrit, and none of the other deprecated methods
are called outside of the implementations of those two methods. Removing
the obsolete methods is left to the maintainers of the extensions, as
keeping them hurts nothing and is needed to maintain compatibility with
earlier versions of MediaWiki.

Change-Id: Ie11a401d60c834059fbf1b5625ca8ea093b3337c
2014-08-07 16:51:19 +01:00
Reedy
e48ecbc524 Switch API to use Config classes
Only done where globals are config (so not $wgParser, $wgContLang etc)

Change-Id: Ic39cdd858cfb9096a2bc09618f97e64270d76f13
2014-06-15 23:56:38 +01:00
Thiemo Mättig
23632a4ecd Use precise ApiMain/ApiQuery type hints in all API modules
Which type is used depends on the ApiModuleManager responsible for
the API module. There are two managers, one in ApiMain and one in
ApiQuery. Both contain a list of API modules they instantiate.
Both use $this as the first parameter in the constructors of the
individual modules. There is no other regular way to instantiate the
modules, so we know the type must either be ApiMain or ApiQuery.

The lists don't intersect.

I would have prefered the naming scheme $mainModule for ApiMain
modules and $queryModule for ApiQuery modules but since this
doesn't add much I left the shorter variable names untouched.

Change-Id: Ie6bf19150f1c9b619655a06a8e051412665e54db
2014-05-16 11:07:23 -04:00
umherirrender
e63299d208 Fixed some @params documentation (includes/api)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I758fa4ad80ac95e2ddd3770bcb9b7d2e57ec34ea
2014-04-18 13:55:36 +00:00
Brad Jorsch
d9534a5d56 API: Make more continuations unique
API queries must be completely ordered for proper behavior; otherwise
you may get into a situation where a query returns the same continuation
value that was provided. Various modules that have been using timestamps
in/as their continuation parameter can easily run into this problem.

Normally we'd have to add additional fields to the relevant indexes to
be able to make this work without having filesorting queries (which
MySQL really doesn't do well, it fetches all matching rows and only
applies the limit after[1]). But InnoDB has a "feature" where it
effectively appends the table's primary key to all other indexes,[2]
which makes these queries be properly indexed in that situation.
Apparently we're ok with this, since Icc43b62f was merged depending on
this feature.

Also, this change fixes some MySQLisms and other oddities done to
ApiQueryRecentChanges in Icc43b62f.

 [1]: https://dev.mysql.com/doc/refman/5.5/en/limit-optimization.html
 [2]: https://dev.mysql.com/doc/refman/5.5/en/innodb-table-and-index.html

Bug: 24782
Change-Id: I4c9f8c0c2bfd831755d4fa20a18f93fef1effd28
2014-04-11 10:50:16 -04:00
addshore
719d7a2f03 Add final period to API module descriptions
Change-Id: Icae68c1ab1fd0006e00a3a9a56ae8f831d3d0d45
2014-03-10 09:04:08 +00:00
Brad Jorsch
b5df42903d Fix more concatenation errors
Errors were introduced in I763f79c6 and Id5fd7180.

Change-Id: Ieb5189636eb3df54290aaf998834988c81099eb3
2013-12-29 15:08:46 -05:00
aude
09a0607139 Fix string concatenation in api documentation
Change-Id: I4f94172a5e4ad43dd88c21e01148fd94783aca54
2013-12-29 18:40:14 +01:00
Siebrand Mazeland
b9b699cd1f Fix CodeSniffer errors and warnings on a number of ApiQuery classes
Change-Id: I763f79c66cd8ed2ca19586323d5b3ee8b60ffd18
2013-11-15 10:33:50 -08:00
Siebrand Mazeland
56aba313f6 Update formatting on some API classes (must've forgotten these)
Change-Id: I3fe42e75c3029dc76d2d1d40609c9a69aae8e987
2013-11-14 18:13:55 +00:00
umherirrender
6f79eef473 Fixed spacing around parenthesis in includes
Change-Id: Ie8adc00f4ee8ecec4554e584c18d5d2073415397
2013-04-28 15:50:07 +00:00
umherirrender
97234cc884 Added spaces before and removed spaces after 'array'
Fix some other spacing while at it

Change-Id: I13f81533eaf40e06c13cf377c0f08ef5cef01d00
2013-04-14 21:57:46 +02:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
umherirrender
f97a3a4027 fix some spacing
Change-Id: I670a7baf3ba1e70d18346bb00938d518ba2063bd
2013-02-04 19:59:14 +00:00
Yuri Astrakhan
503cd2f4ae (bug 35885) remove api version string and parameter
API was using SVN's version keyword which GIT does not support.
All related methods were either removed, or for those that
could have been used from extensions, emptied out.
api.php?version now shows unrecognized param warning.

Change-Id: I910ca1448ed2ed697ac19b17c486d130aa1d7e03
2013-01-18 12:41:18 -05:00
Yuri Astrakhan
983545c362 API Cleanup: renamed '_badcontinue'->'badcontinue', one die()
* If a query module has 'continue' parameter, it will auto-report
that it has 'badcontinue' error.
* Added APIQueryBase::DieUsageContinueIf( $condition ) that shows
correct badcontinue error if $condition is true.

Change-Id: I9c48bda6de0cde3c117ad24460bddf6980279633
2013-01-14 21:19:16 -05:00
Yuri Astrakhan
32fd68f81c Minor cleanup
Fixed spacing, eol chars, "string" --> 'string'

Change-Id: I630247c6c5b469efb67ec9de32e8533ae88e59fb
2013-01-12 01:50:48 -05:00
Antoine Musso
4f5d2386f3 escape HTML elements in docblock with double quotes
Doxygen choke on text enclosed by '<' and '>' since it tries to
interpret them as HTML or XML elements. This patch adds double quotes
in includes/api/*.php files around the two following strings:

 <Firstname>.<Lastname>@gmail.com
 <Firstname><Lastname>@gmail.com

Which becomes:

 "<Firstname>.<Lastname>@gmail.com"
 "<Firstname><Lastname>@gmail.com"

Tested locally, it prevents doxygen 1.8.0 related warnings.

Change-Id: I36d82eb3fd4989ee3ffc65b0b527b83711d1ba69
2012-07-15 22:15:45 +02:00
Petr Onderka
80aa025528 Added result properties to action=paraminfo
Added information about the properties of the results of API calls
to action=paraminfo, including information about "property groups":
what should the prop parameter be set to to get that property.

Uses the same format for types as parameters already do.
The output format of some modules doesn't fit this, so the result
properties for them weren't added, or only partially.

Partially implemented modules:
* expandtemplates:
  parsetree is in its own tag
* protect, allusers, backlinks, deletedrevs, info, imageinfo,
  logevents, querypage, recentchanges, revisions, searchinfo,
  usercontribs, userinfo, users, watchlist, upload:
  response with partially complex structure

Not implemented modules:
* feedcontributions, feedwatchlist, opensearch, rds:
  non-standard reponse
* help:
  error is normal response; not very useful for automated tools anyway
* paraminfo, parse, pageprops, siteinfo, userrights:
  response with complex structure

Change-Id: Iff2a9bef79f994e73eef3062b4dd5461bff968ab
2012-06-06 19:24:59 +02:00
Aaron Schulz
fdb74872a8 Merge "multi dbms support in api" 2012-05-20 18:15:42 +00:00
umherirrender
278bb4414f multi dbms support in api
Add some calls to Database::timestamp
Change some calls from Database::strencode to
Database::addQuotes to avoid ' in raw sql
Remove ' from ints in raw sql
Rename some vars to avoid duplicate names

Change-Id: I63f5602fa968f969a42932902a3ccc45fc54b432
2012-05-16 19:22:36 +02:00
Petr Onderka
7264a75515 Fixed typo in description in categorymembers module
Change-Id: I7d82df6a4b0f65fe763e0eea23dfa05ae2e7c5f1
2012-05-10 20:36:34 +02:00
Alexandre Emsenhuber
18cc220038 Don't make two database requests to load the same object, again.
I know there's no second parameter to WikiPage::newFromID(), but this will change soon.

This follows-up I098dd36619fff3610be6894037220d3472b809d5.

Change-Id: Ic28b7e05db51e55a5f49fed70c042ba11e4d97fe
2012-05-04 22:10:36 +02:00
umherirrender
e0ded894d9 (bug 30488) API now allows listing of backlinks/embeddedin/imageusage
per pageid

Move the possibles errors set by ApiBase::getTitleOrPageId to
ApiBase::getTitleOrPageIdErrorMessages and remove it from used modules

Change-Id: If037e04665d2524c1f2476bc7996d9573753a4b8
2012-05-02 01:35:04 +01:00
Reedy
b9e6daa3aa Simplify and refactor out api code for getting title or page id
Change-Id: I098dd36619fff3610be6894037220d3472b809d5
2012-04-27 15:58:04 +01:00
Reedy
9081f7e6d0 Normalise categorymembers to take ascending/descending for direction, also adding newer/older to make it like other modules
Change-Id: I50c770b8d48548988a71bcf62b76a9c43fc1622f
2012-04-10 14:02:22 +01:00
Aaron Schulz
5a6559d8b1 Reverted r108743 per CR comment. This should at least be discussed first. 2012-01-12 19:41:18 +00:00
Sam Reed
a5c200a25b Kill "* @return void" 2012-01-12 19:12:24 +00:00
Sam Reed
6115b93df8 Re-instate most of the revisions for bug 33147 "API examples should explain what they do"
Using this to sync up my working copies

Should have the little niggles tidied up though
2011-12-27 16:22:35 +00:00
Brion Vibber
ad0d48d6bc Revert r106439, r106441 - bad formatting mushing separate lines together 2011-12-20 22:11:29 +00:00
Sam Reed
1b46e91efd Convert a few more descriptions
Ping r106439
2011-12-16 15:45:16 +00:00
Sam Reed
53000baecf Oh noes, moar http:// -> https:// 2011-11-28 15:43:11 +00:00
John Du Hart
2e7d867478 Removed the 'eclipse helper' bit on top of every API module
It's a parctice that dates back to 2006 when the API was first written, and frankly isn't covered by the coding conventions. Same thing with the docblocks, they're all copypasted with some bits changed and don't even make sense if you look at them in the genereated code docs.
I don't feel that any of us depend on this anymore (get a better IDE), so in the inerest of consistancy it's time we said goodbye to it.
2011-11-16 00:17:26 +00:00
Sam Reed
2f23e71490 arrray -> array
Whitespace

Other documentation improvements

Comment out some unused code (which has a fixme left with it already)
2011-11-01 23:48:09 +00:00
Roan Kattouw
3a392d1ccf Introduce cmstartsortkeyprefix and cmendsortkeyprefix parameters so categorized pages can be looked up using a category+sortkey combination. Based on a feature request from Danny B on IRC 2011-10-30 18:49:26 +00:00
Roan Kattouw
0755cf92a1 Fix bug in r83814 reported on IRC: categorymembers did not set an ORDER BY when cmcontinue was set, which broke paging when cmdir=desc was used. 2011-10-05 13:15:44 +00:00
Sam Reed
a5628f5734 Based on diff to wikia, set more functions consistently public rather than protected 2011-08-17 22:24:21 +00:00
Sam Reed
9c37ab4fb3 * (bug 28817) Add reference help page link to API Modules
Last followup of r92396

Should be all modules with documentation pages in core now documented...
2011-07-17 17:02:06 +00:00
Sam Reed
25ea9b8d95 Replace more multiple calls to $this->getResult() in methods with temporary variable 2011-06-30 01:06:17 +00:00
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