aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/integration/includes
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | Merge "UserSelectQueryBuilder: Do not consider unregistered actors to be named"jenkins-bot2025-01-021-5/+10
|\ \ \ \
| * | | | UserSelectQueryBuilder: Do not consider unregistered actors to be namedMartin Urbanec2025-01-021-5/+10
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this patch, UserSelectQueryBuilder::named was implemented as an equivalent of `!User::isTemp()`. Unfortunately, that is not fully correct. An IP address is a non-temporary actor, but it is not a named actor. Actors must be BOTH non-temporary AND registered to be considered named. This patch fixes the bug. Bug: T382889 Change-Id: Ie24ccaa0c446150f61772ecfbebe186757fdf26e
* / | | TempAccounts: Set fake timestamps for TempUserCreatorTestxtex2025-01-011-7/+10
|/ / / | | | | | | | | | | | | | | | | | | | | | This has been failing integration tests since 20250101 because all 2024 become 2025. Bug: T382848 Change-Id: I5aa71bb7644cfb42140d8eaba9f408e762b2937c
* | | Merge "Add template expansion statistics to the Parsoid limit report"jenkins-bot2024-12-182-4/+11
|\ \ \
| * | | Add template expansion statistics to the Parsoid limit reportC. Scott Ananian2024-12-042-4/+11
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the legacy parser's ::makeLimitReport() in ParsoidParser to ensure that a number of template-related statistics are included. Protect ParsoidParser with a check of $wgEnableParserLimitReporting like the legacy parser does as well. Bug: T380758 Change-Id: Ibd812676b55eee619f7dbacc476ba84d1b65d005
* | | Merge "Revert "Revision: make RevisionRecord::getPage() return a value object""jenkins-bot2024-12-162-9/+8
|\ \ \
| * | | Revert "Revision: make RevisionRecord::getPage() return a value object"Subramanya Sastry2024-12-162-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1e7a520f1f42770f7eaeb4369805b427efa32634. Reason for revert: Given end-of-year timeline and last train of the year, it is more feasible to chase down the issues in 2025 and reapply this patch then. Bug: T381982 Change-Id: I4ed5406a8b3aa9c038544bfac9ea361550b2c72f
* | | | Merge "block: Multiblocks block API"jenkins-bot2024-12-161-0/+51
|\ \ \ \
| * | | | block: Multiblocks block APITim Starling2024-12-161-0/+51
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In ApiBlock: * Add an "id" parameter. If this is given, update the specified block. * Add a "newblock" parameter. If this is given, always add a new block, don't check if the target is already blocked. * If "reblock" is given and the target has more than one block, fail with an "ambiguous-block" error. Supporting changes: * Add BlockUserFactory::newUpdateBlock(), which takes a DatabaseBlock instead of a target union to act on. The block is passed through to the BlockUser constructor. * Rename the first parameter to BlockUser::placeBlock() from $reblock to $conflictMode, and style it like an enum. Add the CONFLICT_NEW value, to support the "newblock" API option. * In DatabaseBlockStore::newFromId(), add $fromPrimary, so that ApiBlock can pass data to BlockUserFactory with equivalent freshness to the LHS. Also: * In BlockUser, memoize prior blocks loaded from the DB * Move T287798 autoblock check to the memoized accessor. Just don't return autoblocks. * Move "TODO handle failure" comment in BlockUser to the called method. It really can't fail. * In DatabaseBlockStore::newFromId(), add an $includeExpired parameter and default to false although it was previously implicitly true. Based on a brief review of callers, I think this is beneficial. Bug: T378147 Change-Id: Iea5b77cb27006b33f3dde61660be5ad2c374a425
* | | | Merge "tests: Show a more informative error message when teardown is skipped"jenkins-bot2024-12-131-1/+3
|\ \ \ \
| * | | | tests: Show a more informative error message when teardown is skippedTim Starling2024-12-131-1/+3
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If mediaWikiSetUp() is called but not mediaWikiTearDown(), throw an exception when the next test is set up. This previously failed for database tests in ChangedTablesTracker with an unhelpful error message. Interestingly, there was at least one non-database test that was throwing errors from tearDown() unconditionally. Bug: T354387 Change-Id: I9a7b169026f5fb491529b0f8ae7bec582ca485b6
* | | | Move SQL schema and schema changes to new sql/ top-level directoryDaimona Eaytoy2024-12-132-4/+3
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the standard in every extension. DB schema changes are not maintenance scripts, and therefore there's no apparent reason to have the two things together, besides historical reasons. Also, put each DB type in a separate directory, which wasn't the case for MySQL before. For SQLite and Postgres schema changes, we now follow the convention (used everywhere else, including the generateSchemaChangeSql script) of having the DB type as the last part of the path. This lets us generate schema changes for all DB types at once, and without specifying the full file path. Most files are just being renamed, the exceptions being to update references to the old location (sometimes still referencing tables.sql). Note that the old path is still referenced in the autogenerated comment of schema changes SQL files. These will be regenerated in another commit. Instead, the schema files are done now, because they're covered by DatabaseIntegrationTest that would otherwise fail. Bug: T382030 Change-Id: I3b4a614366d0bc629523ac40ce97d001f3b6bcf8
* | | Merge "Silence inserts to the job table in JobQueueDB"jenkins-bot2024-12-061-0/+174
|\ \ \ | |_|/ |/| |
| * | Silence inserts to the job table in JobQueueDBDreamy Jazz2024-12-051-0/+174
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * The JobQueueDB class is the default method used to queue jobs in MediaWiki and uses the job table to store queued jobs. * To insert a job into the queue the class needs to perform writes to the job table, which is done when a transaction is about to commit or there is no transaction active. * Therefore, when a job is inserted to the queue and the job queue uses the JobQueueDB class, it causes a write either immediately or soon after the call. * This means that on GET requests, the write violates the TransactionProfiler expectations. * There is nothing that we can do here to avoid the writes on GET requests, because some code needs to ensure the job is inserted before sending a response. Therefore, we should silence the warnings regarding performing writes. What: * Wrap calls to get a primary DB and inserting to the primary DB in a scope which silences the TransactionProfiler warnings related to using a primary DB connection. * Create tests for JobQueueDB so that the code being added is covered by tests. Bug: T379766 Change-Id: Ibd894ab0b99398429f3d8e9849fc0608f774e6cf
* / Revision: make RevisionRecord::getPage() return a value objectdaniel2024-12-052-8/+9
|/ | | | | | | | | | | | | | | | RevisionRecord::getPage() currently returns a PageIdentity, which may be a Title or a WikiPage. In the context of an ongoing page deletion, the state of these objects may change and the page ID may get set to 0. To provide a reliable stable interface that can be used e.g. in a deferred update or job, we need to return an immutable value object instead. NOTE: this may break callers of getPage() that downcast to Title, or that rely on the page ID contained in the returned PageIdentity to be updated dynamically during page creation or deletion. Bug: T380536 Change-Id: I7440f8f30b05949842903094908232455f6a2239
* Support custom sets of tags in HTMLTagFilterSTran2024-11-251-0/+59
| | | | | | | | | | | | | | | Why: Allow for the `HTMLTagFilter` widget to be customized by passing through the parameters which should be used for the select input's options. What: - Support passing an `isActive` parameter to display all tags (`false`) or only active tags (`true`) - Support passing a `useAllTags` parameter to use all on-wiki tags ('`true`) or only software-defined tags (`false`) Bug: T378622 Change-Id: I73b5566fd54e416cc01fa53f5463a7dd785f857f
* includes/libs/Message: Add return type hints, update methodsDoğu Abaris2024-11-212-2/+2
| | | | | | | | | | | | | | | | | | | Applied return type hints to improve type safety in Message classes. Adjusted constructors to specify parameter types for consistency. Enhanced `newFromJsonArray` in `ScalarParam`, `DataMessageValue`, and `MessageParam` to clarify deserialization logic. Key updates: - Added `: string` return types for `getLangCode`, `getKey`, `dump`. - Added `: array` return type for `getParams`, `getData`, `toJsonArray`. - Revised `ScalarParam` JSON parsing to ensure a consistent return. These adjustments enhance type safety across the Message classes. Depends-On: Id7cc576693f5f1830e1d261cb13c626c901fb40f Depends-On: I260e3f526be10f7b11e5c77a1e300590c6fc5b2b Depends-On: I3c318273856d15407c71cb9b4ab7c23a0debb314 Change-Id: I7e50be91c01b4b70e1d1380651f001e35bd60523
* PHPUnit: Use FQCN with leading backslash in @covers annotationFomafix2024-11-197-7/+7
| | | | | | | | | | | https://docs.phpunit.de/en/11.4/annotations.html#covers recommends: > Please note that this annotation requires a fully-qualified class > name (FQCN). To make this more obvious to the reader, it is > recommended to use a leading backslash (even if this not required for > the annotation to work correctly). Change-Id: I7eb4b997346387e5799fa27a61ab317573124fd0
* SimpleParsoidOutputStash: add serialization test casesC. Scott Ananian2024-11-142-0/+284
| | | | | | | | | | | | The '1.44' test data is the current serialization output. The '1.44_native' test data is the output after I9e6b924d62ccc3312f5c70989477da1e2f21c86b which uses native PageBundle serialization. This is to establish forward-compatibility using the procedure described at https://www.mediawiki.org/wiki/Manual:Parser_cache/Serialization_compatibility Change-Id: I8d53ff3e9c600cce16a0fc07f3665a91e5d8036b
* REST: Allow page endpoint "redirect" parameter to have value "false".bpirkle2024-11-072-0/+59
| | | | | Bug: T374683 Change-Id: Id5072010fae7debe309e59f0479f44fbeb036934
* Merge "RenameUser: Fix invalidated renamer user when self-renames"jenkins-bot2024-11-021-0/+17
|\
| * RenameUser: Fix invalidated renamer user when self-renamesxtex2024-11-021-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | Makes ManualLogEntry::insert uses the right performer user, or else the user will not be found because it has been renamed by themselves. Checks and localisation messages that blocks self-renames are also removed because self-rename is now possible with the fix. Bug: T267477 Change-Id: Ie959e15838f87b1f84b8d90796102c8bd099b76e
* | NamespaceInputWidget: Correctly set default for 'include'Dreamy Jazz2024-11-011-0/+34
|/ | | | | | | | | | | | | | | | | | | | Why: * In 5617115fe22337ba464bd6b253c1d2af941b2adc, the NamespaceInputWidget class was modified to support filtering out all namespaces but a specified few. * The modifications to the ::__construct method incorrectly set the default for this include list as an empty list, which meant that by default all namespaces were excluded. * This commit fixes that to instead make the default null, which does not apply any filtering. What: * Fix NamespaceInputWidget::__construct to correctly set the default for the 'include' configuration value. * Add regression tests with this fix. Bug: T378810 Change-Id: Ie00483641cf058b4522b60a72393a8f1ba4d15a1
* Support 'include' parameter in namespace select inputsSTran2024-10-301-0/+32
| | | | | | | | | | | | | | | | | Namespace select inputs already support an 'exclude' parameter, ignoring any namespaces that match ids in that array. For Special:GlobalContributions, it would be useful to have the opposite - an array of namespaces to be included, as it only wants to support filtering on common namespaces. - Allow an 'include' parameter to be passed through to the namespace select input - Support 'include' in Html inputs and OOUI inputs TODO: Support 'include in Codex inputs (see T378582) Bug: T378179 Change-Id: I4170beb588292fbec26926ca3afe559c25de9f55
* Remove ParsoidOutputAccessC. Scott Ananian2024-10-291-643/+0
| | | | | | This class and all its methods were deprecated in MW 1.43. Change-Id: I514714159cb4a07e157e7bf012327e8bff184d7f
* FileRepo: Add support for the new Shellbox large file featureTim Starling2024-10-291-2/+42
| | | | | | | | | | | | | | | | | | | * Add FileBackend::addShellboxInputFile(), allowing Shellbox to read directly from a FileBackend. Add generic, FS and Swift implementations. * Add FileRepo wrapper, which takes a FileRepo virtual URL. * Add File::addToShellboxCommand(), which allows a File to be used as input in a Shellbox command. * Add configuration. * Extend FileBackend::getFileHttpUrl(), adding method and ipRange parameters. Unindent existing code. I was going to add support for PUT requests, but I reverted it due to the impossibility of supporting FileBackendMultiWrite. I left the method parameter in getFileHttpUrl(). Bug: T292322 Change-Id: If9487a0c9586065bf044b69ac04cc7a06b6e8856
* Merge "Use ++ and -- rather than += 1 and -= 1"jenkins-bot2024-10-231-1/+1
|\
| * Use ++ and -- rather than += 1 and -= 1Reedy2024-10-171-1/+1
| | | | | | | | Change-Id: I27b9a19ab952ede1267921bd042af0fe1c89e228
* | Merge "rdbms: clear replica snapshots in ↵jenkins-bot2024-10-221-1/+1
|\ \ | | | | | | | | | (begin|commit|rollback)PrimaryChanges()"
| * | rdbms: clear replica snapshots in (begin|commit|rollback)PrimaryChanges()Aaron Schulz2024-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Automatically perform the empty-transaction commit logic in methods like beginPrimaryChanges() and commitPrimaryChanges(). This avoids the proliferation of callers having to call the same set of methods one after another for non-obvious reasons. It also discourages code from making brittle assumptions that might fail for setups where there is only a primary or the primary has non-zero read load. Deprecate flushReplicaSnapshots() and remove callers. Clarify the related method documentation. Bug: T315664 Change-Id: I255afd22ffcaeac0fad2d4e4a2a0c55c99be7905
* | | Merge "REST: Add items wrapper for restbase compat to some response bodies"jenkins-bot2024-10-211-12/+13
|\ \ \
| * | | REST: Add items wrapper for restbase compat to some response bodiesbpirkle2024-10-161-12/+13
| | | | | | | | | | | | | | | | | | | | Bug: T374136 Change-Id: I995916f53eb9408923456cce8b1f3be391fbf942
* | | | tests: Use namespaced classesUmherirrender2024-10-218-18/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes to the use statements and some additions are done automatically via script This also updates @covers tag for the namespaced classes Change-Id: I859ba6d05018c99710b744e2becab432410d3bca
* | | | Make Message and MessageValue compatibleBartosz Dziewoński2024-10-193-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix two problems that made it difficult to convert between Message and MessageValue, or to write code that could accept both of them, as exemplified by the StatusValue class: * Implement a common interface * Use the same internal format for message parameters While these changes should be compatible with most of existing code, where the authors were courteous enough to simply call methods such as Message::numParam() and not look inside the values they return, it is potentially a breaking change for anything that depended on the formatted params being arrays or accessed their keys. Example patches: https://gerrit.wikimedia.org/r/q/topic:message-param Notable changes: * Message and MessageValue now both implement MessageSpecifier (only Message implemented it before). * Message::numParam() and other static methods for encoding params now return MessageParam objects, instead of special arrays. Use these MessageParam objects internally in Message. * Narrow down the return type of MessageSpecifier::getParams() (it was just `array`, allowing any type in the array). Narrow down the types for Message::params() and MessageValue::params() to match. * Deprecate MediaWiki\Message\Converter. As a replacement add MessageValue::newFromSpecifier(), which is analogous to Message::newFromSpecifier(), but without weird legacy edge cases. * Make StatusValue::getMessages() return MessageValues. Remove code that converted between Message and MessageValue, no longer needed. * Update many type declarations and comments to use MessageSpecifier instead of MessageValue, as well as a couple of tests that depended on implementation details. Bug: T358779 Change-Id: I625a48a6ecd3fad5c2ed76b23343a0fef91e1b83
* | | | Merge "Use statslib for metrics emitted by HtmlInputTransformHelper, ↵jenkins-bot2024-10-173-31/+49
|\ \ \ \ | |_|_|/ |/| | | | | | | HtmlToContentTransform"
| * | | Use statslib for metrics emitted by HtmlInputTransformHelper, ↵Yiannis Giannelos2024-10-173-31/+49
| |/ / | | | | | | | | | | | | | | | | | | HtmlToContentTransform Bug: T359475 Change-Id: I7d4ca748c106dfd560dae31294decfb2b181e2db
* | | Merge "Adding token validation to the edit handler"jenkins-bot2024-10-172-21/+50
|\ \ \
| * | | Adding token validation to the edit handlerWendy Quarshie2024-09-262-21/+50
| | | | | | | | | | | | | | | | Change-Id: I86fa7d613aa79e07ce20ea7936becf02f25832ac
* | | | Merge "Use explicit nullable type on parameter arguments"jenkins-bot2024-10-169-11/+11
|\ \ \ \
| * | | | Use explicit nullable type on parameter argumentsUmherirrender2024-10-169-11/+11
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicitly marking parameter $... as nullable is deprecated in php8.4, the explicit nullable type must be used instead Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a Break one long line in SpecialPage.php Bug: T376276 Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
* | | | Merge "Stop using heavy Language object when not needed"jenkins-bot2024-10-161-2/+1
|\ \ \ \
| * | | | Stop using heavy Language object when not neededAmir Sarabadani2024-10-161-2/+1
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | Two easy cases, way more can be done. Bug: T376565 Change-Id: I3b875c4b6b2c2bdf7171a712898d50e26d86c807
* / / / Replace uses of deprecated ChangeTags static methodsJames D. Forrester2024-10-164-11/+8
|/ / / | | | | | | | | | | | | Bug: T360664 Change-Id: I3363a225e54bb2cae01ba066d432a8b7b21933d2
* | | Namespace all remaining classes in includes/parserJames D. Forrester2024-10-157-9/+9
| | | | | | | | | | | | | | | Bug: T353458 Change-Id: If02cc9b1ff78e26c1cf8c91ee4695845eb133829
* | | Merge "Add namespace to maintenance/includes classes"jenkins-bot2024-10-151-0/+1
|\ \ \
| * | | Add namespace to maintenance/includes classesJames D. Forrester2024-10-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Also a few other fixes of PHP class aliases spotted by phan. Bug: T353458 Change-Id: Ie79d65722c47c24f8f20f1293355cfd3c2e8c2ad
* | | | tests: Remove global state from Rest Handler testsUmherirrender2024-10-112-8/+4
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | Functions provided by the HandlerTestTrait and used in other rest tests Reduce session leaking from global state within the rest test Bug: T376970 Change-Id: Ie0dc52441c6a6ca408812c5d0cc6d791834780e5
* | | ParsoidParser: ensure magic variable expansion uses pageLanguageOverrideC. Scott Ananian2024-10-091-5/+23
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds tests for the caching fix in Ie76020dc4fa3545f827e1674051530b479f01f31, but these tests also revealed that the recursive invocation of the legacy parser to expand magic variables like {{PAGELANGUAGE}} wasn't using the pageLanguageOverride, aka ParserOptions::getTargetLanguage(). The page language override is used when parsing new context which doesn't currently exist in the database and therefore doesn't have a page language set by its title (which doesn't yet exist). Bug: T376783 Follows-Up: Ie76020dc4fa3545f827e1674051530b479f01f31 Change-Id: If6fe7cf00be6e78ef46181b17f01138383e95e46
* | UserSelectQueryBuilder: temp() should not select non-temp usersGergő Tisza2024-10-072-20/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When temp users are not configured, temp() was a no-op; it should be the empty condition instead. Didn't cause any problems (the only caller is expireTemporaryAccounts.php and that does check the isKnown() flag first) but would be an easy mistake to make in the future. Corresponding CentralAuth patch: I107222c77d8f6dc4caee0db4f706108a2581b4bd Bug: T372702 Change-Id: I904bbb97b028702ecfe98c97e3f821ba6038e27a
* | Use statslib for metrics emitted by HtmlOutputRendererHelperYiannis Giannelos2024-10-042-4/+5
| | | | | | | | | | Bug: T359476 Change-Id: If8bc5a7f7383dcb67dadf1f4c02d1b69d7c8fa53