aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api
Commit message (Collapse)AuthorAgeFilesLines
* Refactor ApiEmailUser to use EmailUser/EmailUserFactory classes.Lewis Cawte2024-05-044-38/+43
| | | | | | | Removes usage of various deprecated SpecialEmailUser classes. Bug: T362636 Change-Id: Ieb71a3741348ca9dae8c5bf32e891fee458ed5b2
* Merge "block: Fix ApiQueryBlocks query error when a table prefix is used"jenkins-bot2024-05-041-1/+1
|\
| * block: Fix ApiQueryBlocks query error when a table prefix is usedTim Starling2024-04-231-1/+1
| | | | | | | | | | | | | | If a qualified field name is used, the table part must either refer to an alias or the output of tableName(). Change-Id: I59839a3d0061b471b65c4e33c78e6ea92c1d2906
* | Remove unused TitleParser in ApiFeedContributionsaddshore2024-05-042-6/+0
| | | | | | | | Change-Id: I0c57684b30365b9e5e3f2346bd342122c9d45309
* | Merge "namespace MWDebug"jenkins-bot2024-05-031-0/+1
|\ \
| * | namespace MWDebugAmir Sarabadani2024-05-031-0/+1
| | | | | | | | | | | | | | | Bug: T353458 Change-Id: I99d728bd111ff882220cd175ff09d4da20b81eae
* | | Merge "api: Join actor conditionally on list=logevents"jenkins-bot2024-05-031-11/+14
|\ \ \
| * | | api: Join actor conditionally on list=logeventsUmherirrender2024-04-301-11/+14
| |/ / | | | | | | | | | | | | | | | When nothing is used from actor, do not add it to the query Change-Id: I7b0095befd4403395a0bf7c0958adbbefa229020
* | | Merge "docs: Adjust all @deprecated tags to use 'since…' for consistency"jenkins-bot2024-05-021-1/+1
|\ \ \ | |/ / |/| |
| * | docs: Adjust all @deprecated tags to use 'since…' for consistencyJames D. Forrester2024-05-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This skips ones that have been marked but were never in the then RELEASE-NOTES and later HISTORY file, and so weren't properly deprecated ever. Change-Id: I31df2d7e83182b5bf9524237fc4a1862356bfd5a
* | | Merge "Temporary accounts: Perform redirect for first successful edit"jenkins-bot2024-04-301-2/+12
|\ \ \ | |/ / |/| |
| * | Temporary accounts: Perform redirect for first successful editKosta Harlan2024-04-291-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - We want to make sure that the top-level redirect fires for temporary accounts which were created in an edit attempt, but did not yet save an edit What: - In EditPage and ApiEditPage, perform the redirect if there is a saved temp user as part of the current process, or if the user account is a temporary one and it has no edits. Note that this means the top-level redirect would be performed if a temp user creates a first edit on a non-home wiki: - logged out user makes a failed attempt on wiki A, temp account is created - same user makes a successful edit on wiki A, redirect hook fires - same user visits wiki B and makes a succesful edit, redirect hook fires Note: - We could consider setting a query parameter like `createdinrequest=1` to signal to TempUserCreatedRedirect implementations that the temporary account was created in the current request, and did not exist earlier. But I am not sure if we have a use case for needing that, so have left it out of this patch. Bug: T359405 Change-Id: If4b8c561383f993606c0ba565591871195a1f8c2
* | | Merge "api: Reduce use of WebRequest in action=upload"jenkins-bot2024-04-291-12/+6
|\ \ \ | |/ / |/| |
| * | api: Reduce use of WebRequest in action=uploadUmherirrender2024-03-291-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $this->mParams['file'] and $this->mParams['chunk'] are set to instance of \Wikimedia\ParamValidator\Util\UploadedFile in the validation step. Use ApiMain::getUpload Fix ApiUploadTestCase to set error key to OK, the null gets converted to UPLOAD_ERR_NO_FILE in \Wikimedia\ParamValidator\Util\UploadedFile::getError and breaking the test. Change-Id: If57307a3f8278fd3fa25732231595bf148935679
* | | ApiQuerySiteInfo: Minor cleanupReedy2024-04-281-8/+6
| | | | | | | | | | | | | | | | | | | | | * Remove 2 uses of unnecessary temporary variables * Update code order for imagelimits to be more standardised Change-Id: I4bcaa272e18ab326e66784a0a0e6baf10e08d02a
* | | Migrate several more raw SQL building to expression buildersAmir Sarabadani2024-04-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also removing a test from WatchedItemQueryServiceUnitTest. These tests have been written extremely poorly and have caused issue many times over the years not allowing us to do any refactors. There are still pretty good integration tests in place. Bug: T361023 Change-Id: I400294fbbe70ac98508f254a4ed72be14e018975
* | | Localisation updates from https://translatewiki.net.Translation updater bot2024-04-261-0/+1
| | | | | | | | | | | | Change-Id: Ie8c672d34451df3dd141ebce9f3cd6f3339042b4
* | | Catch exceptions from ::isWriteMode in ApiMain::sendCacheHeadersDreamy Jazz2024-04-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * Modules that extend ApiQueryBase are loaded using the ApiQuery module. This defines an override to the ApiBase::isWriteMode method that loads the modules. * Using the mModule when $isError is true could lead to the exception that was thrown in ::executeAction being thrown again. * Therefore, ApiMain::sendCacheHeaders should only call the ApiBase::isWriteMode method if the request did not fail with an error that caused $isError to be true. * Without this fix, ApiUsageExceptions appear in logstash as exceptions, as described in T363133. What: * Only interact with $this->mModule if the $isError argument is false. If $isError is true, assume that ::isWriteMode would return true. Assuming this will also avoid error responses being marked as fresh for any amount of time, as the error may be temporary. * Add a test that verifies that the method does not throw if ApiBase::isWriteMode throws an ApiUsageException. Bug: T363133 Change-Id: I41d869c257878b8a94d6c40332e2028405de8729
* | | Merge "Use expression builder to avoid raw sql via BETWEEN operator"jenkins-bot2024-04-231-3/+1
|\ \ \
| * | | Use expression builder to avoid raw sql via BETWEEN operatorUmherirrender2024-04-211-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | Replace BETWEEN with >= and <= operator Change-Id: Ic21b6f4cc11c773c967d9d4c5f20e762c2ff9629
* | | | Localisation updates from https://translatewiki.net.Translation updater bot2024-04-231-5/+5
| |_|/ |/| | | | | | | | Change-Id: Ic5cdf47ff6dcfc05a903a3dfb4d87d04c956bb89
* | | Ignore/fix MediaWiki.Commenting.PropertyDocumentation.WrongStyleTaavi Väänänen2024-04-222-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Fix the real issues found by this sniff, and convert the remaining false positive ignores to per-line ignores so that any more real issues won't be added. Change-Id: I18e75d59df327e2d93a3a487c115e92b9f268722
* | | Use ignore comments for MediaWiki.Usage.ExtendClassUsage.FunctionVarUsageTaavi Väänänen2024-04-222-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Instead of globally ignoring this sniff, convert the current violations (which set the variable so can't be fixed easily yet) to use local phpcs comments to silence the errors. Change-Id: I490cbf4915e2705383edb4a2fc5ddc1efd55c960
* | | Localisation updates from https://translatewiki.net.Translation updater bot2024-04-221-0/+2
| | | | | | | | | | | | Change-Id: Ie61eccca7d801fd832b615f3ca7c6dbe6aabeedc
* | | api: Fix PSR2.Classes.PropertyDeclaration.Multiple errorsTaavi Väänänen2024-04-2114-52/+152
|/ / | | | | | | Change-Id: I7859191740d66d00595c4bdeea12b227ac25bcc5
* | Fix some line indentUmherirrender2024-04-202-2/+2
| | | | | | | | Change-Id: I8f82724197d20f9289d80e138d80310f1eab29f2
* | api: Pass wikiId to UserIdentity instance for action=userrightsUmherirrender2024-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Action API action=userrights is using the special page to lookup the user and since c87c8f64 this returns a UserIdentityValue instead of UserRightsProxy for cross-wiki changes But the getId() call was not updated to use the same wikiid to get the id. This results in an assertion error. Before that change api was returning the foreign user id (via UserRightsProxy), so it should remain to do that. Bug: T362740 Change-Id: If0cd239e8603d5b577184f0122cb74a28dafdab8
* | search: Use ServiceOptions not full config objectDerick Alangi2024-04-161-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch uses the recommended MW practice for injecting settings into MW services. Instead of passing in the full config object, pass in service options which MW service wiring will use to lookup settings/options from config sources. So in this patch, the various options have been identified and put into `CONSTRUCTOR_OPTIONS` constant and inject via service wiring. Test plan ========= Ensure that the special page: `Special:Search` still works with this patch checkout on your local test wiki. When you visit `Special:Search` on your local wiki, you should see a search form view. Type in something like: "Main Page" and then hit search. If everything works well, then local test passes. NOTE ==== This patch also resolves a TODO which mentions the removal of the `getConfig()` method from the SearchEngineConfig class. Change-Id: Ib5dfc10f3f210c6c35247f4f30f9549dd60e0af7
* | Localisation updates from https://translatewiki.net.Translation updater bot2024-04-161-11/+11
| | | | | | | | Change-Id: Id9b705a44efaa35442d3dd72258c15530c4d1cc0
* | Localisation updates from https://translatewiki.net.Translation updater bot2024-04-151-0/+5
| | | | | | | | Change-Id: I308f15e4c38d6e89ccd7c1fd0f95c42e5a89825b
* | Merge "api: Replace null $httpCode by 0 in ApiBase::dieWithErrorOrDebug"jenkins-bot2024-04-121-1/+1
|\ \
| * | api: Replace null $httpCode by 0 in ApiBase::dieWithErrorOrDebugUmherirrender2024-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The $httpCode is passed to Exception::__construct and type-hinted as integer since php8.2 When a module requires POST, but is used with GET a deprecation notice is shown in php8.2 validatepassword: Passing null to parameter #2 ($code) of type int is deprecated Bug: T362272 Change-Id: Ib5c6a24abf0808a0557c57170279b325b4bddcea
* | | Merge "Substitute category default sort key when filling links table, not at ↵jenkins-bot2024-04-111-1/+5
|\ \ \ | | | | | | | | | | | | parse time"
| * | | Substitute category default sort key when filling links table, not at parse timeC. Scott Ananian2024-03-291-1/+5
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures uniform treatment of all places that call `addCategory` without duplicating the `defaultsort` code; it also ensures that the effect of the {{DEFAULTSORT}} parser function is independent of page position. Bug: T40435 Bug: T353530 Change-Id: I4480a6d59e766fa4eddc9ec9117c58b66771bb47
* | | Document more methods that accept MessageSpecifier, not just MessageBartosz Dziewoński2024-04-093-7/+7
| |/ |/| | | | | | | | | | | These methods can already handle any MessageSpecifier, but their documentation didn't show this. Change-Id: I1323d18baf17a8a27cc9bed31860c4cc89e61a22
* | Merge "Define ApiQuery::isWriteMode"jenkins-bot2024-04-091-0/+16
|\ \
| * | Define ApiQuery::isWriteModeDreamy Jazz2024-04-051-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * ApiQueryBase subclasses may define a ::isWriteMode override, as the API call may need to write to the DB. ** This is the case for the CheckUser extension, where the 'checkuser' API creates a log entry that allows users to audit usage of the API. * ApiQuery currently does not define a implementation of ::isWriteMode, which means that the definitions by any class that extends ApiQueryBase currently do nothing. * ApiQuery::isWriteMode should be defined and work in a similar way to ApiQuery::isReadMode, so that subclasses of ApiQueryBase can have their definitions of ::isWriteMode respected. What: * Define ApiQuery::isWriteMode in a similar way to how ApiQuery ::isReadMode is written, but also inspecting the modules that are used through the 'list' and 'prop' params. * Add tests for ApiQuery::isWriteMode. Bug: T361951 Change-Id: Idf1c8f95df58a861404e0c89507c885ec4554793
* | | ApiResult: Make array ordering consistent across PHP versionsMáté Szabó2024-04-051-1/+22
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PHP 8.2 makes krsort() use the stricter numeric comparison semantics[1] introduced in PHP 8.0 when it is comparing a numeric key with a non-numeric key. This changes result ordering in ApiResult for arrays that contain a mix of numeric and non-numeric keys. Make the ordering consistent across PHP versions by using an user-defined comparison function instead that always considers a non-numeric string to be smaller or equal in a comparison of a non-numeric and a numeric string. [1] https://wiki.php.net/rfc/string_to_number_comparison Bug: T326480 Change-Id: I91d55a1d516e4f0ec31f00a719c6616c73b7f786
* | Localisation updates from https://translatewiki.net.Translation updater bot2024-04-042-34/+45
| | | | | | | | Change-Id: Ib8f03d481f8888325c6aa245c7ef2b2af90c076f
* | Localisation updates from https://translatewiki.net.Translation updater bot2024-04-031-0/+1
| | | | | | | | Change-Id: Ifefb091d860ff63c39f24e2bd491b1afc1ddb735
* | Localisation updates from https://translatewiki.net.Translation updater bot2024-04-012-1/+2
| | | | | | | | Change-Id: I0f9358936e25b52c391d6552fc822df683178fe0
* | Merge "Use explicit value checks where "0" is valid input"jenkins-bot2024-03-301-1/+3
|\ \ | |/ |/|
| * Use explicit value checks where "0" is valid inputMatěj Suchánek2024-02-221-1/+3
| | | | | | | | | | | | | | User "0", page "0" and edit summary "0" are all valid. Treating them as empty may cause subtle inconsistencies. Change-Id: I90a92bfb972cca840e5d8060dac3f116a22990db
* | Localisation updates from https://translatewiki.net.Translation updater bot2024-03-291-1/+1
| | | | | | | | Change-Id: I1a9293e1a6f8cc121a0d55a973ca05b6785dc038
* | Merge "Switch Special:Upload to use async upload-by-url"jenkins-bot2024-03-281-3/+4
|\ \
| * | Switch Special:Upload to use async upload-by-urlGiuseppe Lavagetto2024-03-281-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, when async uploads are enabled, upload-by-url will spawn a job and a form with a button to check the status of the process is shown to the user. In the process, add processing of warnings in the remote jobs spawned by the API or the Special page. This is done by adding checks to UploadJobTrait::verifyUpload. In order to manage warnings serialized in the job status, a method to unserialize the result of UploadBase::makeWarningsSerializable. Things that we might want to fix: * The form's UI is abysmal, we should probably use Codex * While it's not a huge deal, I'd like to figure out why I need to purge the page cache if I want the file to show up. And more interestingly, why this doesn't happen when uploading via the API Bug: T295007 Bug: T118887 Change-Id: I49181d93901f064815808380285fc4abae755341
* | | Localisation updates from https://translatewiki.net.Translation updater bot2024-03-271-5/+8
| | | | | | | | | | | | Change-Id: I6b06aba12ed9a3b14ab72e74a7da8387ac2f0770
* | | Localisation updates from https://translatewiki.net.Translation updater bot2024-03-261-6/+6
| | | | | | | | | | | | Change-Id: I5670330cfac9b57b5a0d0a40a5cfa744998c8f12
* | | Merge "Allow async upload by url via the Api"jenkins-bot2024-03-251-26/+64
|\| |
| * | Allow async upload by url via the ApiGiuseppe Lavagetto2024-03-231-26/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To this end if 'async' is passed with 'url' to the api: * Avoid downloading the file synchronously, but verify early if the upload is allowed by adding a canFetchFile to UploadBase overridden in UploadFromUrl * Spawn an UploadFromUrlJob * When checking for the status of the job, do it fetching the data in the main stash. Bug: T295007 Change-Id: If95ccf376cfa9fbe9b3cd058e8e334a6bdd2eb44