Commit graph

43 commits

Author SHA1 Message Date
Reedy
4691389fa4 Use (int) rather than intval()
Bug: T216969
Change-Id: I4c06716c83b69d128f26fa7f68736808aa2d3d64
2019-02-25 00:38:33 +00:00
Thiemo Kreuz
734a969d55 Safe replacement of a lot of !count() with === []
This was originally a global search and replace. I manually checked all
replacements and reverted them if (due to the lack of type hints) either
null (that would be 0 when counted) or a Countable object can end in the
variable or property in question.

Now this patch only touches places where I'm sure nothing can break.

For the sanity of the honorable reviewers this patch is exclusively touching
negated counts. You should not find a single `!== []` in this patch, that
would be a mistake.

Change-Id: I5eafd4d8fccdb53a668be8e6f25a566f9c3a0a95
2019-01-15 17:28:49 +01:00
Umherirrender
c9d303d39e Remove "Created on" from file header comments
It is the job of git and svn to provide this information/metadata.
The form was different, some with short, some with long month name
some with leading zero at the day, some without.
The year is also present in the Copyright clause

Change-Id: If006907b82b9e45f13cfa2e45d41107a95570e1a
2018-01-26 23:12:40 +00:00
Baha
036b9c4167 Make API documentation links language aware
Links generated by the API are now aware of the user's preferred
language and will show documents in that language if available.

To test, log in to mediawiki.org and set your language preference to 'es',
then on an MediaWiki installation with this patch view the generated
expanded API help at `api.php?action=help&recursivesubmodules=1&modules=main`.
Each link to documentation on mediawiki.org should take you to its
translated /es subpage, if one exists.

Bug: T104518
Change-Id: I339a1f3ae1bce9d759cf251899d57c32b1def91e
2017-04-05 11:08:25 -04:00
Reedy
f8a58fa67e Remove some unused variables
Change-Id: Ia3a290555f06c564c063591710380367a04cb1cc
2016-02-20 20:22:56 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Cindy Cicalese
86c08b2401 Converted ApiQueryPageProps to use PageProps; added multi-property query to PageProps.
Change-Id: Icd4540001e044052ae5759c87c8b83a70ab5c30f
2016-02-16 13:39:47 -05:00
Anomie
a91ec5abe1 Revert API part of "Add page_props table access class"
This partially reverts commit e48030a7ae.

Change-Id: I31869acdaed8c2f5acfd9780887fbd3ab175bbe9
2016-01-19 12:49:43 -05:00
Cindy Cicalese
e48030a7ae Add page_props table access class
Bug:T115331
Change-Id: I022b9e3ca47dc63650b8a62260603b0893a80e69
2016-01-15 03:51:57 +00:00
RobinHood70
15ecc5a93a Update getHelpUrls() for reworked mw.org API pages
Community members restructured the mediawiki.org API pages, e.g.
the meta allmessages query submodule is no longer in the catch-all
https://www.mediawiki.org/wiki/API:Meta?oldid=1408361#allmessages_.2F_am
but its own https://www.mediawiki.org/wiki/API:Allmessages

The links in the generated API help, e.g.
https://www.mediawiki.org/wiki/Special:ApiHelp/query+allmessages,  are no
correct. They're not 404s but they don't take you directly to the
relevant page.

This patch set fixes the getHelpUrls() URLs (and does nothing else).
I tested them all.

Thanks RobinHood70!

Change-Id: Icea94abdd22d1ad468172642a21641e7c5ce2046
2015-05-04 08:15:54 +00:00
jenkins-bot
9e18610457 Merge "Better pageprops API example" 2015-04-24 13:43:59 +00:00
S Page
3cdc12c609 Better pageprops API example
Change example query from non-existent Category:Foo to querying Main
Page and MediaWiki, which exist on both enwiki and mediawiki.org (and
have really interesting info on enwiki).

To test, visit api.php?action=help&modules=query+pageprops and try the
example URL.

Change-Id: Ibad1e912bd2fa0f0f627025a60ec137f43a2abe4
2015-04-23 18:40:33 -07:00
Brad Jorsch
beab6b009e Change API result data structure to be cleaner in new formats
Nothing in this patch should result in changed output for format=json or
format=php except as noted in RELEASE-NOTES-1.25, and changed output for
format=xml should be similar or cosmetic. However, other code accessing
the result data directly may need to be updated.

Bug: T87053
Bug: T12887
Change-Id: I3500708965cb8869b5aed1543381aad208dadd13
2015-04-20 17:49:37 -04:00
Brad Jorsch
f62bc7536e API: Fix access on getExamplesMessages
ApiBase declares it protected, but for some reason I had made it public
in all subclasses.

Change-Id: I8a50d4f47e66c7f09137968d3941dc5cdc1d28e4
2014-10-29 11:15:27 -04:00
Brad Jorsch
ad225f501c API: Internationalize all remaining core API modules
This also adds some new ApiBase::PARAM_* constants to generate more
helpful help, and a method to override the default description message
for the use of ApiDisabled and ApiQueryDisabled.

Bug: 71638
Change-Id: Ic0c3d232e0498d58a043037e2e0c6f0b1c3edad3
2014-10-20 16:56:35 -04: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
addshore
719d7a2f03 Add final period to API module descriptions
Change-Id: Icae68c1ab1fd0006e00a3a9a56ae8f831d3d0d45
2014-03-10 09:04:08 +00:00
Siebrand Mazeland
770f2a2d41 Fix CodeSniffer errors and warnings (you guessed it, on API classes)
Change-Id: I56f9632975d53bdfe33ff9412e1a4ba010bdb2aa
2013-11-15 18:08:13 +00:00
Siebrand Mazeland
789c20044b Update formatting, return of the API classes
Change-Id: I8c3a5b4396a1c3bba22f676137f640c6aa3c8960
2013-11-14 18:25:45 +00:00
Brad Jorsch
0ae0c665f5 (bug 43251) API prop=pageprops ppprop should accept multiple values
There is no reason for this parameter not to accept multiple values, the
query is structurally exactly the same as for something like
prop=categories&clcategories=....

Unless, of course, we need to support page props with "|" in the name.

Change-Id: I38cd83e213ede8e626d55c079c5c1b6f7e727336
2013-02-20 08:42:53 -05: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
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
a5628f5734 Based on diff to wikia, set more functions consistently public rather than protected 2011-08-17 22:24:21 +00:00
Sam Reed
d5e46f9614 Followup r92396
More modules documented, pretty much only action=query&list= to be done (ie links added where documentation pages exist already)
2011-07-17 16:51:11 +00:00
Sam Reed
5db6b7ab5c * (bug 27479) API error when using both prop=pageprops and prop=info&inprop=displaytitle
Followup r75282

Patch by Brad Jorsch
2011-02-16 23:38:21 +00:00
Sam Reed
27c07317c4 * (bug 26480) add a pppageprops param to prop=pageprops 2011-01-05 22:11:39 +00:00
Sam Reed
c5c5092156 Minor code order tweaks in ApiQueryPageProps.
Remove getPossibleErrors, as it adds an error that this module doesn't through
2011-01-05 21:59:05 +00:00
Sam Reed
1f05665cf3 Styleli[zs]e the API up to date (Been a while since) 2010-12-30 17:06:09 +00:00
Bryan Tong Minh
2259ecd6d7 Follow-up to r75282: don't query if there are no pages to query 2010-12-29 20:32:14 +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
Bryan Tong Minh
9af2264645 Follow-up r75282
* Use addWhere instead of addWhereFld
* Don't add properties twice if there is a continue
* Add comments
2010-10-26 19:31:47 +00:00
Sam Reed
d194b9a179 Followup r75282, remove now unused class variables 2010-10-26 16:37:15 +00:00
Bryan Tong Minh
fae7025644 Follow-up r70638:
* Use a single query to get the page_props instead of one per page
* Removed the $wgPageProps global
* Removed a lot of useless crap
2010-10-23 18:53:39 +00:00
Sam Reed
550271e806 Explicit class variable definition
Parameter hints
2010-10-06 21:18:55 +00:00
Sam Reed
48a042cbf6 Remove some unneeded whitespace 2010-08-23 22:18:05 +00:00
X!
c9f278aa4a Fix r70770: Will I ever get this working? :) 2010-08-09 21:03:13 +00:00
X!
f40723965b Followup to r70701: Facepalm fixing. 2010-08-09 16:26:35 +00:00
X!
b528bcdf89 Followup to r70638: Clean up code, add prop to function args, add comment 2010-08-08 14:55:08 +00:00
Alexandre Emsenhuber
457eb73b61 Standardised file description headers, added @file 2010-08-07 19:59:42 +00:00
X!
685ef510ee -(bug 24484) Add prop=pageprops module
-Add $wgPageProps global variable
2010-08-07 18:50:23 +00:00