aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiQueryAllCategories.php
Commit message (Collapse)AuthorAgeFilesLines
* api: Use type-declaration for string arg in ApiBase::__constructUmherirrender2024-10-171-5/+1
| | | | | | | Also for all sub-classes Remove simple doc-blocks without further information Change-Id: I981934efe32d44f52e5ab865a9b887be5bd0f41e
* Add namespace to includes/api classesJames D. Forrester2024-09-251-0/+5
| | | | | Bug: T353458 Change-Id: I3ea6b08c5018ba03ba45c5766e1f46e12f6b8597
* api: Migrate away from buildLike to expression builderAmir Sarabadani2023-11-081-4/+10
| | | | | | | | Also while we are here, migrate buildComparison() calls with one field only to expr() Bug: T210206 Change-Id: I2ac7adbe4fb26af3383a38106e9a36381148c828
* Api: Fix some very old copyright statements for RoanJames D. Forrester2023-03-161-1/+1
| | | | Change-Id: I820a2d388922653a6a5b9048b0feaafbb4297d91
* Reorg: Namespace the Title classJames D. Forrester2023-03-021-0/+1
| | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* Deduplicate code for parsing API 'continue' parametersBartosz Dziewoński2022-09-291-4/+2
| | | | | | | | | | | | | | 30+ API modules had nearly identical code to split and validate the value of the 'continue' parameter. Introduce the ApiBase::parseContinueParamOrDie() method and use it to replace most usages of ApiBase::dieContinueUsageIf(). A few remain in modules with more complex continuation handling. Inline most single-use variables that remained after validation was moved into the new method. Change-Id: I66bd59ecd4ad16e2039e90f7d66cfa276e6c1c2a
* Use buildComparison() instead of raw SQL in more API modules (easy cases)Bartosz Dziewoński2022-09-291-3/+3
| | | | | | | | | | | | | | | | See ec79aa394312d62b598ad29601e2c80eaaf0dd19 about the new method. These changes all follow the same simple patterns. More complex cases are handled in I6231b6beae13474d4986929367a9adc6bb76b0db. This commit was created by running the following terrible Ruby script I devised: https://phabricator.wikimedia.org/P34833, then manually reviewing the results: checking that the output makes sense in general, that the affected variables are not used elsewhere in the file, and that no comparison conditions have been lost. A few incorrect changes were undone or corrected. Change-Id: I8ed363bd6b80a9481d44434a526f078cce20220f
* api: Replace numerous deprecated constantsReedy2022-06-061-12/+15
| | | | Change-Id: I34ffcb70efbfa257da8dab6e0790aa0d697caf5b
* Use array_fill_keys() instead of array_flip() if that reflects the ↵Tim Starling2021-06-151-1/+1
| | | | | | | | | | | | | | | | | | developer's intention array_fill_keys() was introduced in PHP 5.2.0 and works like array_flip() except that it does only one thing (copying keys) instead of two things (copying keys and values). That makes it faster and more obvious. When array_flip() calls were paired, I left them as is, because that pattern is too cute. I couldn't kill something so cute. Sometimes it was hard to figure out whether the values in array_flip() result were used. That's the point of this change. If you use array_fill_keys(), the intention is obvious. Change-Id: If8d340a8bc816a15afec37e64f00106ae45e10ed
* Add PHPDoc documentation to all API query module constructorsThiemo Kreuz2020-10-271-0/+4
| | | | Change-Id: I2bc140576efc891bb9b6e50e44041d5bb022ac8f
* Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNullJames D. Forrester2020-01-101-3/+3
| | | | Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
* Improve param docsUmherirrender2019-11-281-1/+1
| | | | Change-Id: I746a69f6ed01c3ff000da125457df62b02d13b34
* Use (int) rather than intval()Reedy2019-02-251-3/+3
| | | | | Bug: T216969 Change-Id: I4c06716c83b69d128f26fa7f68736808aa2d3d64
* Remove "Created on" from file header commentsUmherirrender2018-01-261-4/+0
| | | | | | | | | 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
* Make API documentation links language awareBaha2017-04-051-1/+1
| | | | | | | | | | | | | | 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
* Convert all array() syntax to []Kunal Mehta2016-02-171-33/+33
| | | | | | | | | | 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
* ApiBase::PARAM_DFLT => null is the default anywayThiemo Mättig2015-10-051-2/+0
| | | | Change-Id: Ic3deeb6b3d7cacbdb85da9ba3cb19051c1182b8f
* API: Use message-per-value for apihelp-query+allcategories-param-propumherirrender2015-08-061-1/+2
| | | | | | | | | | | Use message-per-value for message apihelp-query+allcategories-param-prop to allow smaller strings for translation. Each prop in a message also will show up a new parameter on the help page without the adjust of the translation (but than in english instead of fully skip it). Change-Id: Ib20310fd6cb67b61c8cd8b2bc0add1e12d630818
* Change API result data structure to be cleaner in new formatsBrad Jorsch2015-04-201-2/+2
| | | | | | | | | | | 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
* API: Overhaul ApiResult, make format=xml not throw, and add json formatversionBrad Jorsch2015-04-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ApiResult was a mess: some methods could only be used with an array reference instead of manipulating the stored data, methods that had both array-ref and internal-data versions had names that didn't at all correspond, some methods that worked on an array reference were annoyingly non-static, and then the whole mess with setIndexedTagName. ApiFormatXml is also entirely annoying to deal with, as it liked to throw exceptions if certain metadata wasn't provided that no other formatter required. Its legacy also means we have this silly convention of using empty-string rather than boolean true, annoying restrictions on keys (leading to things that should be hashes being arrays of key-value object instead), '*' used as a key all over the place, and so on. So, changes here: * ApiResult is no longer an ApiBase or a ContextSource. * Wherever sensible, ApiResult provides a static method working on an arrayref and a non-static method working on internal data. * Metadata is now always added to ApiResult's internal data structure. Formatters are responsible for stripping it if necessary. "raw mode" is deprecated. * New metadata to replace the '*' key, solve the array() => '[]' vs '{}' question, and so on. * New class for formatting warnings and errors using i18n messages, and support for multiple errors and a more machine-readable format for warnings. For the moment, though, the actual output will not be changing yet (see T47843 for future plans). * New formatversion parameter for format=json and format=php, to select between BC mode and the modern output. * In BC mode, booleans will be converted to empty-string presence style; modules currently returning booleans will need to use ApiResult::META_BC_BOOLS to preserve their current output. Actual changes to the API modules' output (e.g. actually returning booleans for the new formatversion) beyond the use of ApiResult::setContentValue() are left for a future change. Bug: T76728 Bug: T57371 Bug: T33629 Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678f
* API: Fix access on getExamplesMessagesBrad Jorsch2014-10-291-1/+1
| | | | | | | ApiBase declares it protected, but for some reason I had made it public in all subclasses. Change-Id: I8a50d4f47e66c7f09137968d3941dc5cdc1d28e4
* API: Internationalize all remaining core API modulesBrad Jorsch2014-10-201-26/+8
| | | | | | | | | 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
* API: Remove action=paraminfo 'props' and 'errors' result propertiesBrad Jorsch2014-08-071-17/+0
| | | | | | | | | | | | | | | | | 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
* Use precise ApiMain/ApiQuery type hints in all API modulesThiemo Mättig2014-05-161-1/+1
| | | | | | | | | | | | | | | | | 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
* Fixed some @params documentation (includes/api)umherirrender2014-04-181-1/+1
| | | | | | | | | 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
* Add final period to API module descriptionsaddshore2014-03-101-1/+1
| | | | Change-Id: Icae68c1ab1fd0006e00a3a9a56ae8f831d3d0d45
* Fix CodeSniffer errors and warningsSiebrand Mazeland2014-02-051-2/+6
| | | | Change-Id: Idc74e34634d88625773fb8f73315f61edfa67e28
* Fix capitalization in ApiQueryBase::titlePartToKey()btongminh2013-12-231-4/+5
| | | | | | | | | | | | ApiQueryBase::titlePartToKey now allows an extra parameter that indicates the namespace in order to properly capitalize the title part. This allows list=allcategories, list=allimages, list=alllinks, list=allpages, list=deletedrevs and list=filearchive to handle case-sensitivity properly for all parameters. Bug: 25702 Change-Id: Iaa5a71ec536f3716f54bc84b39f645545dfd8660
* Fix CodeSniffer errors and warnings (final round for API classes)Siebrand Mazeland2013-11-151-2/+4
| | | | Change-Id: I97bf36ebef254818dc17378a06405b681ad19c59
* Update formatting on API classes, Part 3Siebrand Mazeland2013-11-141-1/+1
| | | | Change-Id: I526be68e21836201c992b391a81f4d41e1fa801e
* ApiResult::setContent is staticumherirrender2013-04-301-1/+1
| | | | Change-Id: Ifee10208e8b79928ecaa47f541bb61dd6e9c29e4
* fix some spacingumherirrender2013-03-251-1/+1
| | | | | | | | | | | * Removed spaces around array index * Removed double spaces or added spaces to begin or end of function calls, method signature, conditions or foreachs * Added braces to one-line ifs * Changed multi line conditions to one line conditions * Realigned some arrays Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
* (bug 35885) remove api version string and parameterYuri Astrakhan2013-01-181-4/+0
| | | | | | | | | 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
* API Cleanup: renamed '_badcontinue'->'badcontinue', one die()Yuri Astrakhan2013-01-141-10/+1
| | | | | | | | | * 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
* Remove a bunch of trailing spaces and unneeded newlinesumherirrender2012-10-101-1/+0
| | | | Change-Id: I00f369641320acd7f087427ef031f3ee7efa0997
* Allow aliased field names with separated syntaxumherirrender2012-08-151-1/+1
| | | | | | | | | | | | | | | This introduce the syntax from aliased table names for aliased field names into the abstract database layer: array( 'alias' => 'field' ) gives 'field AS alias' This patch also includes changes to query pages, api and some more places to show, how the new syntax looks in "production". This allow us to remove the "AS" for Non-PostgreSQL databases, if we want that. Change-Id: I5f0de1c2f29092c173aec3de93ffdef436799e8d
* Merge "Revert "Do not show empty categories with list=allcategories""Aaron Schulz2012-07-211-1/+0
|\
| * Revert "Do not show empty categories with list=allcategories"Petr Onderka2012-07-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 4b9bd6a4dba57026b2f18d4024b021407e52ff4f. This change made allcategories less useful, because it means it's impossible to list empty categories (previously, acmax=0 did that). To exclude empty categories, acmin=1 can be used. Change-Id: I7943507c4cb7d752f82caa69ce3edb0b31ca9463
* | Merge "escape HTML elements in docblock with double quotes"Aaron Schulz2012-07-181-1/+1
|\ \ | |/ |/|
| * escape HTML elements in docblock with double quotesAntoine Musso2012-07-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Avoid mangling fields in API continuation parametersBrad Jorsch2012-07-171-3/+21
|/ | | | | | | | | | | | | | | | | | | | | | | API continuation parameters encode sufficient state for a subsequent query to continue where the previous one left off; this may sometimes include page titles, with or without the namespace. Given that these page titles are already in the exact format required for the next request's SQL query, it is not necessary to "normalize" them in any way. And if normalization does more than just change spaces to underscores or vice versa (e.g. it canonicalizes namespace aliases or capitalizes the first letter of the title), it can be actively harmful: see bug 36987 and bug 29290. Note this patch involves a breaking API change: the values for the "continue" parameter of various modules have been changed, and some modules will now return "continue" as the continuation parameter instead of reusing "from". Note this patch also corrects a minor logic bug in ApiQueryAllLinks, changing ">" to ">=". The line is being changed anyway, so I didn't bother doing a separate changeset. Change-Id: I459232e919d20f89f6de9d20640fd48c8fd5781c
* Do not show empty categories with list=allcategoriesumherirrender2012-07-131-0/+1
| | | | | | Special:Categories is also not showing empty categories. Change-Id: If23a763c887ed827ed548ff2af6abea04e46dbb9
* Added result properties to action=paraminfoPetr Onderka2012-06-061-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* ApiPageSet::populateFromTitles can work with Titlesumherirrender2012-05-121-1/+1
| | | | Change-Id: I492c350cbb487c1a35bc96c7bcf5f0af9a9d530c
* ORDER BY/GROUP BY accept arraysumherirrender2012-05-051-1/+2
| | | | | | | renaming all variable which hold "' DESC'" to $sort to keep it all the same Change-Id: I75118f8cdd701f53949fe5cdd7155fb07f78ff65
* (bug 35855) fix min and max parameters in list=allcategoriesPetr Onderka2012-04-161-1/+6
| | | | | | | | API queries for list=allcategories with acdir=descending had the acmin and acmax parameters in reverse, that is min behaved like max and max behaved like min. This patch fixes the issue. Change-Id: If6346b682782856ffa5b15d08abd1b2ecc50424c
* More documentation updates as I've been going aroundSam Reed2011-12-111-1/+0
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/105830
* Oh noes, moar http:// -> https://Sam Reed2011-11-281-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/104445
* Removed the 'eclipse helper' bit on top of every API moduleJohn Du Hart2011-11-161-5/+0
| | | | | | | | 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. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/103273
* Based on diff to wikia, set more functions consistently public rather than ↵Sam Reed2011-08-171-1/+1
| | | | | | | protected Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/94827