aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiMain.php
Commit message (Collapse)AuthorAgeFilesLines
...
| * ArchivedRevisionLookup: Allow lookups using just the revision IDBartosz Dziewoński2023-09-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | A unique index on ar_rev_id was added in T193180 (2019), allowing revisions of deleted pages to be reliably looked up by just their ID. Use the improved getArchivedRevisionRecord() method in a few places that previously had to use manual queries. Bug: T251066 Change-Id: I9352f64952ac4b803d76e9e72f88a01be7317c56
* | ApiMain: Do not allow negative max ageAlexander Vorwerk2023-09-041-2/+5
|/ | | | | Bug: T345544 Change-Id: I79b8bc8204871ef629b302cc870c9a22f60883f7
* api: Use ParserFactory on module creationUmherirrender2023-08-291-3/+3
| | | | | | | | Change "Parser" to "ParserFactory" in object specs and get a instance when needed Bug: T343070 Change-Id: I9b65c272726bb0035f4cdca4fbf417a0a11375cb
* Merge "Remove deprecated ActorMigration usages around ContribsPager"jenkins-bot2023-08-261-1/+0
|\
| * Remove deprecated ActorMigration usages around ContribsPagerFunc2023-08-251-1/+0
| | | | | | | | Change-Id: I1a4224eac8bad47f7228faf68ea7f9c7d44a44ad
* | api: Add watch option for userpage to action=userrightsUmherirrender2023-08-251-0/+3
|/ | | | | Bug: T272294 Change-Id: I8078bb4a2f5cc2e45e8eb7a8ab29a71f5edb5ba8
* Reorg: Move MWTimestamp to MediaWiki\UtilsAmir Sarabadani2023-08-191-0/+1
| | | | | Bug: T321882 Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
* ApiEditPage: Check permissions of the temp user if we will create oneBartosz Dziewoński2023-08-081-0/+2
| | | | | Bug: T342770 Change-Id: I024c79551ca9d67e4e7e91cce028b25718141232
* Acquire a temporary user username before previewingBartosz Dziewo?ski2023-07-311-0/+6
| | | | | | | | | | | * Add an API action=acquiretempusername * Add a mw.config variable with the temp user name * Add mw.user.acquireTempUserName, which checks the mw.config variable, then fetches a name from the API * Use mw.user.acquireTempUserName when previewing Bug: T331397 Change-Id: Iec8a15dadd595bed0f7e54f907fbb8e192b45cf3
* api: Replace deprecated ApiPageSet::getRedirectTitles in action=parseUmherirrender2023-06-271-0/+1
| | | | | Bug: T339384 Change-Id: Iabcaf55723118660648472047e0fd1f7cee56a50
* Merge "api: Replace deprecated ApiPageSet::getGoodPages in action=query"jenkins-bot2023-06-261-0/+2
|\
| * api: Replace deprecated ApiPageSet::getGoodPages in action=queryUmherirrender2023-06-161-0/+2
| | | | | | | | | | | | | | | | | | Inject TitleFormatter and TitleFactory to improve the best case (getGoodPages) to avoid calling the factory there instead of using Title::getPrefixedText after calling factory Bug: T339384 Change-Id: I21cf9b738cfdb1a418c10e48ec834efefccb6ab7
* | Merge "api: Replace deprecated ApiPageSet::getMissingTitles in action=watch"jenkins-bot2023-06-261-0/+1
|\ \
| * | api: Replace deprecated ApiPageSet::getMissingTitles in action=watchUmherirrender2023-06-161-0/+1
| |/ | | | | | | | | Bug: T339384 Change-Id: I6ca0620f943557e9cc977c4b22f27975295b0811
* | Merge "api: Replace ApiPageSet::getTitles in setnotificationtimestamp"jenkins-bot2023-06-261-0/+2
|\ \
| * | api: Replace ApiPageSet::getTitles in setnotificationtimestampUmherirrender2023-06-161-0/+2
| |/ | | | | | | | | | | | | | | | | Reduce creating of Title objects to minimum place and use the TitleFormatter instead. Getting the known state may moved to own service. Bug: T339384 Change-Id: I712c5abe426940a4dd1c3b384e356845175c0ae3
* | Merge "api: Replace deprecated ApiPageSet::getTitles in imagerotate"jenkins-bot2023-06-261-0/+1
|\ \
| * | api: Replace deprecated ApiPageSet::getTitles in imagerotateUmherirrender2023-06-161-0/+1
| |/ | | | | | | | | Bug: T339384 Change-Id: I3b151ab81dd129a9f5642d76f35240a2ecd78f74
* | API: Replace deprecated calls to wfExpandUrl with UrlUtils::expandJames D. Forrester2023-06-221-1/+3
| | | | | | | | | | Bug: T319340 Change-Id: Ic987f9381ac17e9e46504abdb2d07a5a94ba3b4a
* | Merge sequences of `if` that end doing the same thing anywaythiemowmde2023-06-161-14/+7
|/ | | | | | | | | Motivation: * Avoid code duplication. * Hopefully make it easier to read. * Also order stuff from cheap to expensive, if possible. Change-Id: I575e3f2027ce60a0d0885be5b9bd3e07bc035eee
* Merge "Start using ChangeTagsStore"jenkins-bot2023-06-091-0/+1
|\
| * Start using ChangeTagsStoreAmir Sarabadani2023-06-091-0/+1
| | | | | | | | | | | | | | Also some clean ups here and there Bug: T245964 Change-Id: Ibf20eec3257a2dc54e3ccbe766b679ebdfbab8d9
* | Replace more usages of deprecated MWExceptionDaimona Eaytoy2023-06-081-3/+2
|/ | | | | Bug: T328220 Change-Id: Ib619ead0f397188d828e6e5dfc80ed1fa7175c7d
* api: Drop ApiQuery::getNamedDB() and ApiQueryBase::selectNamedDB()Amir Sarabadani2023-06-011-1/+0
| | | | | | | | Both deprecated in 1.39 and hard-deprecated. Unused in production and allow us to clean up dependency of ApiQuery to LB. Depends-On: Ia94618b7f58fcca72e903fd2e2e9f0aaa501ac24 Change-Id: Ie0322e5346b94932a2eddc0b7aad5a384768b888
* Merge "api: Use a temp placeholder for signature on preview/pst"jenkins-bot2023-05-101-0/+6
|\
| * api: Use a temp placeholder for signature on preview/pstUmherirrender2023-05-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For pst on parse/compare/editstash/(all)revisions/(all)deletedrevisions Do not show the IP when IP masking is enabled, instead show a previous aquired temp name or a placeholder on preview. MediaWiki itself used this for the ajax preview on GUI's action=edit Cannot acquire a new unsaved temp user as api parse does not persist the global session (each request results in a new id) and it would require a db write on a read request. Bug: T331397 Change-Id: I74bb4d655f371bd99e3b618d1a0ac45d730c746c
* | api: Switch to use IConnectionProviderAmir Sarabadani2023-04-241-3/+3
| | | | | | | | | | | | | | As much as possible Bug: T330641 Change-Id: Icb943d6d65b210760ba8966419327c9603e768e0
* | Specials: Mass switch everything to IConnectionProvider from LBAmir Sarabadani2023-04-191-1/+1
|/ | | | | Bug: T330641 Change-Id: Ie1772da59f92213fea598f02385c3e0ac6d200a7
* Ensure ApiHelp correctly types values in TOCData objectsSubramanya Sastry2023-04-121-3/+3
| | | | | | | * Broken since 153a415742087b5e51af46d98f5b72b56dc1b49d Bug: T334551 Change-Id: Id46ba8096beb29d4ece35a6c41b94237e5d9fe1e
* Fix some PHPStorm inspections (#1)Tim Starling2023-03-251-1/+1
| | | | | | | | | | | | * Triple backslash in regex should really be quadruple backslash * Using the returned value of a void method * Immediately overwritten array keys * Duplicate array keys * Foreach variable reuse * sprintf() with too many params * Incorrect reference usage Change-Id: I3c649b543c9561a1614058c50f3847f663ff04df
* profiler: Add ProfilingContext classAaron Schulz2023-03-231-0/+2
| | | | | | | | | | | | | | | | | | Use this class to track the entry point and handler used for requests, making it available for use in profiling, stats, and logging code. This makes it possible for periodic and/or shutdown profiling callbacks to know the basic action handler that applies to the request (if any). Metric names can easily include this string along with MW_ENTRY_POINT to create per-action profiling dashboards. This info cannot otherwise be acquired from things like excimer stack traces since the router and handler classes do not appear in the stack during PRESEND deferred updates and variations like ApiMain/SpecialPage "inclusion mode" would have to be detected somehow. Bug: T330810 Change-Id: Icca5a7a343faeeb18652994c96752acb61a61fd1
* api: Add watch option for userpage to action=unblockUmherirrender2023-03-081-0/+3
| | | | | Bug: T257662 Change-Id: I73e26bb97a16579a76ea8dc992157d8180193f27
* Reorg: Migrate WikiMap to WikiMap/ out of includesAmir Sarabadani2023-02-271-0/+1
| | | | | | | And WikiReference Bug: T321882 Change-Id: I60cf4b9ef02b9d58118caa39172677ddfe03d787
* Reorg: Move HTML-related classes out of includes/ to Html/Amir Sarabadani2023-02-161-0/+1
| | | | | Bug: T321882 Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
* rdbms: Consolidate logger channels into oneTimo Tijhof2023-01-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Notable changes: * In SqlBagOStuff::getConnectionFromServerInfo, only two loggers were injected. The rest implicitly got a NullLogger due to being absent. These are now effectively unsilenced. * Database::__construct() required almost all parameters, even the loggers. I've wanted to move some of DatabaseFactory into the ctor here for a while. In order to make this change not a breaking change, the new 'logger' parameter is optional with NullLogger as default. This allowed some of the test cases, which were simply passing NullLogger, to be fixed by passing nothing instead of passing the new option name. The Database class is behind a dozen layers of indirection for real use, so this will still be injected just fine (DBF, LB, LBF, MWLBF, etc.). * In LegacyLogger, the handling for $wgDBerrorLog was previously limited to DBConnection and DBQuery. This now includes errors from other (generally, newer) parts of Rdbms as well, which were previously missing. This only affects sites (typically CI and dev setup) where $wgDBerrorLog is used, as opposed to the more common $wgDebugLogGroups by-channel configuration. * TransactionProfiler gets its logger injected in a rather odd way, via entrypoints (MediaWiki.php, ApiMain.php, and MaintenanceRunner) as opposed to service wiring. This is kept as-is for now. * In LBFactoryTest, in particular testInvalidSelectDBIndependent2, there are cases that intentionally produce failures of which the result is then observed. In CI we assert that dberror.log is empty so instead of adding the missing logger fields to that LBFactory instance, the only one set (replLogger) is removed. The alternative is to set 'logger' now, which would naturally cause CI failures due to unexpected entries coming through to non-mocked error log. Bug: T320873 Change-Id: I7ca996618e41b93f488cb5c4de82000bb36e0dd3
* Replace some tivial ??= with even more trivial ??thiemowmde2022-12-231-3/+3
| | | | | | | | | Patch Ifa7a9bc replaced some longer `=== null` constructs with the new ??= operator we have since PHP 7.4. However, some of these can be simplified even more with the ?? operator we have since PHP 7.0. Follow-Up: Ifa7a9bc7b2ec415ad7ecb23f4c1776f51f58fd6b Change-Id: I7b05e723810558bb5437adc97eab54ca04d38c06
* Make use of ??= in more placesDannyS7122022-12-171-4/+2
| | | | | | New feature from PHP 7.4 Change-Id: Ifa7a9bc7b2ec415ad7ecb23f4c1776f51f58fd6b
* Merge "Use str_starts_with/str_ends_with/str_contains"jenkins-bot2022-12-141-2/+2
|\
| * Use str_starts_with/str_ends_with/str_containsUmherirrender2022-12-121-2/+2
| | | | | | | | | | | | | | Use the new function in conditions to avoid creating substrings or to search the whole string Change-Id: Ibad6b1b447a4f62cceb34359231f88ebb967a90b
* | Merge "rdbms: add statsd metrics to TransactionProfiler"jenkins-bot2022-12-131-7/+12
|\ \ | |/ |/|
| * rdbms: add statsd metrics to TransactionProfilerAaron Schulz2022-11-301-7/+12
| | | | | | | | | | | | | | | | | | This makes it easy to create alerts based on graphite metrics. Each (event name, HTTP method) pair will have a counter metric, with *.rate measuring the rate of requests violating the rule. Bug: T258125 Change-Id: I7de56fbdfde25fa8f695416ddf27e2fe357b71dc
* | Reorg: Move DummyLinker and Linker to linker/Amir Sarabadani2022-12-081-0/+1
|/ | | | | | | This feels like a no-brainer unless I'm missing something obvious Bug: T321882 Change-Id: Id49c3d0dd6ea4593211048850856b5b8e05a8fb3
* Make RequestContext::sanitizeLangCode() accept nullTim Starling2022-11-021-1/+0
| | | | | | | | | | | | | | | I think it's within the meaning of the method to sanitize the type of the input. Code review shows that it's almost always called with technically nullable input, so it's convenient to deal with nulls at this single place. The linked bug is a PHP 8.1 deprecation warning due to a test which set up a StaticUserOptionsLookup without a language option. StaticUserOptionsLookup does not fall back to the site defaults, so the language was null, causing an error from strtolower(). Bug: T322099 Change-Id: I6dc61476c6869a7648a67be79a4835a5ac24fa92
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-281-3/+5
| | | | | | | | | | | | | | | Redoing I5ea70120d74 but without moving WebRequest that caused issues with phan-taint-plugin. Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequestUpload Bug: T321882 Change-Id: I832b133aaf61ee9f6190b0227d2f3de99bd1717b
* Revert "Reorg: Move some of request related classes to MediaWiki/Request"Zabe2022-10-271-6/+3
| | | | | | | | | This reverts commit 2bdc0b2b7209441a42a784157633a8a01b321922. Reason for revert: T166010#8349431 Bug: T166010 Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-261-3/+6
| | | | | | | | | | | | | Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequest - WebRequestUpload Bug: T166010 Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
* Reorg: Move StubObject classes in includes to its own directoryAmir Sarabadani2022-10-251-0/+1
| | | | | Bug: T166010 Change-Id: Idcf0e9dc6e0841e4f132207bce0f96774dad898c
* rdbms: Drop deprecated functions from LoadBalancerAmir Sarabadani2022-09-291-1/+1
| | | | | | | | | - ::haveIndex() - ::isNonZeroLoad() Deprecated in 1.34 and unused. Change-Id: I08f8d8cad51ab1ec3c385c06737116d7ab71f2ca
* user: Move logic for unregistered HTTPS pref to User::requiresHTTPS()Umherirrender2022-08-061-2/+1
| | | | | | | | | | | | | Move the User::isRegistered call into the function to let all callers benefit from that check. This is more than an error check, it also is business logic representing the effective default for unregistered users which is non-obvious and benefits from being written down as part of a central contract. Update tests as the user must exists on the database to have preferences. Change-Id: Ibacdd642d03031d9659a821045788046f0187518
* API: Use arrays when writing multiple HTML.php classesJames D. Forrester2022-06-141-1/+1
| | | | Change-Id: I9e0e261c5577ca3506004e31e46aacfd05a84130