aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiQueryIWLinks.php
Commit message (Collapse)AuthorAgeFilesLines
* api: Use type-declaration for string arg in ApiBase::__constructUmherirrender2024-10-171-6/+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
* Get correct main page in API call examplesAmmar Abdulhamid2023-09-201-1/+4
| | | | | | | | | | | | | | Remove hardcoded "Main Page" and use whatever the main page of the wiki is. Many wikis have their main page in a different title than the default or even in a different namespace entirely. With the hardcoded title this produces broken/redlink for the doc examples and makes it overall less useful. Most typical examples; Mediawiki.org itself, Wikidata.org, etc. Bug: T235207 Change-Id: Ia9eee76544cad153166dd5a2eb8e8c1bf3a38b74
* Use real type hints for services etc. in api/ApiQuery*.phpBartosz Dziewoński2023-08-291-2/+1
| | | | | | | | | | | | | | | Mostly used find-and-replace: Find: /\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?)[\s\*]+/\s*(private|protected|public) (\$[a-z]\w+;\n)((?=\s*/\*[\*\s]+@var (I?[A-Z](\w+)(?:Interface)?))\n|) Replace with: \3 \1 \4 Followed by some manual review to make sure I'm not changing too much, omitting some changes that looked too complicated and anything that caused test failures, and some whitespace fixes. Change-Id: Ie78be1c614985d7c2964156e454cc9266515dc18
* API: Replace deprecated calls to wfExpandUrl with UrlUtils::expandJames D. Forrester2023-06-221-2/+13
| | | | | Bug: T319340 Change-Id: Ic987f9381ac17e9e46504abdb2d07a5a94ba3b4a
* 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-8/+4
| | | | | | | | | | | | | | 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-10/+8
| | | | | | | | | | | | | | | | 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 more deprecated constantsReedy2022-06-061-1/+1
| | | | Change-Id: I498a315b8b4b56d5e2f939e797adbe0487cd7d07
* api: Replace numerous deprecated constantsReedy2022-06-061-10/+13
| | | | Change-Id: I34ffcb70efbfa257da8dab6e0790aa0d697caf5b
* api: Replace ApiPageSet::getGoodTitles where PageIdentity is not usedUmherirrender2022-02-111-3/+4
| | | | Change-Id: I6097c3e2e75715d40e067b6913849e930f40c876
* 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
* Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNullJames D. Forrester2020-01-101-1/+1
| | | | Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
* Use (int) rather than intval()Reedy2019-02-251-1/+1
| | | | | Bug: T216969 Change-Id: I4c06716c83b69d128f26fa7f68736808aa2d3d64
* Remove "Created on" from file header commentsUmherirrender2018-01-261-2/+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
* API: i18n for warnings and errorsBrad Jorsch2016-12-061-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | API warnings and error messages are currently hard-coded English strings. This patch changes that. With a few exceptions, this patch should be compatible with non-updated extensions: * The change to ApiBase::$messageMap will blow up anything trying to mess with it. * The changes to the 'ApiCheckCanExecute' hook will cause a wrong (probably unparsed) error message to be emitted for extensions not already using an ApiMessage. Unless they're currently broken like Wikibase. Bug: T37074 Bug: T47843 Depends-On: Ia2b66b57cd4eaddc30b3ffdd7b97d6ca3e02d898 Depends-On: I2e1bb975bb0045476c03ebe6cdec00259bae22ec Depends-On: I53987bf87c48f6c00deec17a8e957d24fcc3eaa6 Depends-On: Ibf93a459eb62d30f7c70d20e91ec9faeb80d10ed Depends-On: I3cf889811f44a15935e454dd42f081164d4a098c Depends-On: Ieae527de86735ddcba34724730e8730fb277b99b Depends-On: I535344c29d51521147c2a26c341dae38cec3e931 Change-Id: Iae0e2ce3bd42dd4776a9779664086119ac188412
* Convert all array() syntax to []Kunal Mehta2016-02-171-28/+28
| | | | | | | | | | 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
* API: Log all deprecated parameter uses to api-feature-usage.logBrad Jorsch2015-11-031-1/+0
| | | | | | | | | Some were being logged, and some weren't. Let's log them all automatically when PARAM_DEPRECATED is processed, instead of requiring each module to manually log them. Bug: T117569 Change-Id: Ia38aeeccd0b9857b12b28914f509284483fbcca8
* API: Use message-per-value for apihelp-query+iwlinks-param-propumherirrender2015-08-061-1/+2
| | | | | | | | | | | Use message-per-value for message apihelp-query+iwlinks-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: I1f83d9383d7c22f5469e7c911f0dbcd8a729ac65
* API: Overhaul ApiResult, make format=xml not throw, and add json formatversionBrad Jorsch2015-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-33/+16
| | | | | | | | | 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: Add iwprop=url, deprecate iwurl for prop=iwlinksBrad Jorsch2014-08-201-3/+24
| | | | | | | | Someone objected to the possibility of removing the deprecated llurl because prop=iwlinks still had an iwurl parameter, and they wanted parallelism. So let's deprecate iwurl too. Change-Id: I675c36868d6ce531a9de632203ca7b9742d63be1
* API: Remove action=paraminfo 'props' and 'errors' result propertiesBrad Jorsch2014-08-071-19/+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
* Add final period to API module descriptionsaddshore2014-03-101-1/+1
| | | | Change-Id: Icae68c1ab1fd0006e00a3a9a56ae8f831d3d0d45
* Fix a few more CodeSniffer errors and warnings on some API classesSiebrand Mazeland2013-11-151-3/+10
| | | | Change-Id: I119be629d8c8811d08413751bcffc0ce403cc2bd
* Yet more formatting updates for yet more API classesSiebrand Mazeland2013-11-141-7/+7
| | | | Change-Id: Iaa1cfaaffc7c55bb7670dfbff3f063cf22434f09
* Add helpurls to some api modulesumherirrender2013-05-161-0/+4
| | | | Change-Id: I41cc20ea5daf089e5fb26d1548d3b58cfe5f4d31
* Added spaces before and removed spaces after 'array'umherirrender2013-04-141-1/+1
| | | | | | Fix some other spacing while at it Change-Id: I13f81533eaf40e06c13cf377c0f08ef5cef01d00
* (bug 36400) API: Fix sorting for iwlinks, langlinksBrad Jorsch2013-04-031-3/+4
| | | | | | | | | | | | | | | | | The iwlinks and langlinks modules continue parameters imply ordering by page then prefix then title. But in certain modes, the actual queries use a different ordering, which may result in skipped or repeated results. This changeset fixes that. To do so, it needs to re-add an index iwl_prefix_from_title which was mistakenly removed in 2010 (r69721). And while it's doing that, it cleans up errors in the sqlite and postgresql handling of the iwlinks indexes too. Also, per Asher, make the iwl_prefix_from_title and iwl_prefix_title_from indexes non-UNIQUE. Change-Id: I607e8bf9183a2d8152a6127a81c83a0b5bba0c61
* (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-5/+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
* 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-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | 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
* Added result properties to action=paraminfoPetr Onderka2012-06-061-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* ORDER BY/GROUP BY accept arraysumherirrender2012-05-051-7/+7
| | | | | | | renaming all variable which hold "' DESC'" to $sort to keep it all the same Change-Id: I75118f8cdd701f53949fe5cdd7155fb07f78ff65
* (bug 26909) follow up r102947: fix the navigation with 'dir'umherirrender2012-03-301-6/+8
| | | | | | | | | and 'continue' for some prop-Modules Due to missing change of the where for the query-continue in my first patch, using dir=descending will end up in a loop Change-Id: I6a9ade9feddcfd046de347cd83a756af828b5c18
* Re-instate most of the revisions for bug 33147 "API examples should explain ↵Sam Reed2011-12-271-2/+1
| | | | | | | | | | | what they do" Using this to sync up my working copies Should have the little niggles tidied up though Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/107393
* Revert r106439, r106441 - bad formatting mushing separate lines togetherBrion Vibber2011-12-201-1/+2
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/106879
* Convert a few more descriptionsSam Reed2011-12-161-2/+1
| | | | | | | Ping r106439 Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/106441
* 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
* (bug 26909) Add dir parameter for prop= API modules. Modified patch by ↵Roan Kattouw2011-11-141-4/+19
| | | | | | | Umherirrender Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/102947
* Make the PROTO_ parameter to wfExpandUrl() explicit in all calls. There are ↵Roan Kattouw2011-08-191-1/+1
| | | | | | | now no calls to wfExpandUrl() in core that rely on PROTO_CURRENT being the default. Also switch to using getCanonicalUrl() for.... rel="canonical" :D (I picked the right name, I KNEW IT) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/95010
* 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
* Revert r93802 per CR. Will avoid cache pollution by splitting the cache insteadRoan Kattouw2011-08-031-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/93806
* Followup r92044: force HTTP on URLs output by the API, now that ↵Roan Kattouw2011-08-031-1/+1
| | | | | | | wfExpandUrl() has a flag for this Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/93802
* * (bug 29684) Set forgotten parameter types in ApiQueryIWLinksSam Reed2011-07-261-2/+2
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/93193