aboutsummaryrefslogtreecommitdiffstats
path: root/includes/user
Commit message (Collapse)AuthorAgeFilesLines
...
| * | Remove trivial 1-line PHPDocs that just repeat the codethiemowmde2025-01-163-12/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | I assume these are all either auto-generated by an IDE or the language-level type declarations have been added later. In any case the comments don't add any new information to what the code already says. This is just extra clutter that makes the code harder to read, I would argue. There are many, many more comments like this. In this patch I intentionally focus on the most trivial 1-line comments. Change-Id: Ia294bf4ce0d8a77036842fe25884bc175c2b0e7d
* / ConditionalDefaultsLookup: Move the hook call to the service itselfMartin Urbanec2025-01-141-6/+17
|/ | | | | | | | | | | | As part of T383701, I am planning to add a new hook to the service, to allow extensions to modify ConditionalUserOptions. That hook would be cubersome to call from ServiceWiring. In order to maintain a single pattern, this patch refactors the service to contain the call. Bug: T383701 Change-Id: Idf5e84543f996a500a66c72b6bac97d188995de9
* user: Use ILBFactory::getAutoCommitPrimaryConnection()Amir Sarabadani2025-01-092-16/+11
| | | | | | | Simplify code Bug: T383246 Change-Id: I5e48b7dde63e5d62e316e47cd2e32bde8a17437b
* Merge "user: Move UserOptionsUpdateJob to /includes/user/Options"jenkins-bot2025-01-081-0/+62
|\
| * user: Move UserOptionsUpdateJob to /includes/user/OptionsTimo Tijhof2024-12-181-0/+62
| | | | | | | | | | Bug: T364652 Change-Id: I778a164d8eb2da9707ba4e3e1c7075bd627c0985
* | Merge "user: Tag UserArrayFromResult as `@internal` class"jenkins-bot2025-01-084-10/+15
|\|
| * user: Tag UserArrayFromResult as `@internal` classTimo Tijhof2024-12-184-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why add internal: * The public stable entry point to this object is via methods on the UserArray class. * The constructor is not used outside core. * Most callers already type against UserArray, but a few type against UserArrayFromResult directly whicih seems needlessly specific. * UserArrayFromResult is already not stable to extend. * UserArrayFromResult defines no public methods that aren't already on UserArray, thus interchangable from a type hint perspective. Why move Countable: * Phan will rightfully flag `count(WikiPage::getContributors)` as invalid after this patch, e.g. in core CreditsAction.php, unless UserArray is also Countable. * There is no use of `new UserArray\b` anywhere. * There is no use of `extends.*UserArray\b` outside core, only UserArrayFromResult, which is inside core. * This follows-up I7d6b3bc1b0 (1a3f73dd8c) for T60377. Bug: T364652 Change-Id: I1933d4d8282f98babe8d0a381f42850f579c9fdd
* | Merge "user: Write UserOptionsStore and User class docs"jenkins-bot2025-01-0433-80/+137
|\|
| * user: Write UserOptionsStore and User class docsTimo Tijhof2024-12-1833-80/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * UserOptionsStore interface. Follows-up If0b775d7ae (652d565584) for T323076, which introduced the UserOptionsStore concept but it wasn't easy to figure out how an instance is obtained, or how it relates to UserOptionsManager. * User class. Summarise the last 10 years of refactoring and decoupling, with references to what we encourage new code to use instead. Remove mention of MW 1.35 newable which is no longer applicable. * Fix file headers and ingroup doc annotations > Add missing `ingroup` to class blocks (and remove from file blocks) > as otherwise the file is indexed twice (e.g. in Doxygen) which makes > navigation on doc.wikimedia.org rather messy. > > Remove duplicate descriptions from file blocks in favour of class > doc blocks. This reduces needless duplication and avoids incorrect > or outdated copies emerging over time, and helps make file headers > more consistently (visually) ignorable. > > Ref https://gerrit.wikimedia.org/r/q/message:ingroup+is:merged+owner:Krinkle+branch:master Bug: T364652 Bug: T323076 Change-Id: I09fe4f64df88b5a83e7c934646467557f3af5fcd
* | Merge "ActorStore: Normalize CannotCreateActorException"jenkins-bot2025-01-031-6/+11
|\ \
| * | ActorStore: Normalize CannotCreateActorExceptionGergő Tisza2025-01-031-6/+11
| |/ | | | | | | Change-Id: Ic2bd012894ecf54dc6e8fb8bf52290ac560ccc16
* / UserSelectQueryBuilder: Do not consider unregistered actors to be namedMartin Urbanec2025-01-021-0/+3
|/ | | | | | | | | | | | | 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
* temp accounts: Break up temporary user names with hyphensThalia2024-12-122-0/+27
| | | | | | | | | | | | | | | | | | | | | Why: * Temporary user names contain a generated part. The method for generating this part is configurable, and uses different implementations of SerialMapping. * The PlainNumericSerialMapping is used by default, but can be difficut to read if the number that is generated is long. What: * Add ReadableNumericSerialMapping, similar to the plain numeric mapping, but with hyphens after every group of 5 digits, for readability. * Make ReadableNumericSerialMapping the default in the config $wgAutoCreateTempUser['serialMapping']['type']. Bug: T381845 Change-Id: I262f1de38370c9e228f2fe804e95d9d43c49ca86
* user: Add newFromNameOrIp() method to UserFactoryAmmarpad2024-12-021-1/+22
| | | | | | | | | | | | | | This simplifies creation of User object for either an IP or a username, without turning off validation for the named user, which causes problems subsequently when other codepaths expect named users passed to them to be valid. Most callers that currently call User/UserFactory::newFromName() with validation turned off can be migrated to this method, which is safer. Bug: T381217 Change-Id: I4a7bae534a06d279492c7e237871e3e8b4ac7167
* Merge "Use real type hints for services etc. in includes/auth/, session/, user/"jenkins-bot2024-11-093-19/+4
|\
| * Use real type hints for services etc. in includes/auth/, session/, user/Bartosz Dziewoński2024-11-023-19/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 More could be done, but to keep this patch reasonably sized, I only changed the most obvious and unambiguously correct cases. In some cases, I also removed redundant doc comments on the constructor, and re-ordered the properties to match the constructor. Bonus: Fix some todos in AuthManagerTest. Change-Id: Ife5313b821cf537984f6de364bfe1d9b4b992a07
* | Merge "CentralIdLookup: delete deprecated factoryNonLocal() method"jenkins-bot2024-11-041-21/+0
|\ \
| * | CentralIdLookup: delete deprecated factoryNonLocal() methodSomeRandomDeveloper2024-10-311-21/+0
| |/ | | | | | | | | | | | | Hard deprecated since MW 1.37, cannot be found in Codesearch, even with "Everything" selected. Bug: T362636 Change-Id: Ie2e09d55a464f72e2fe9a01113629aafc38f2ce9
* / user: Allow excluding autopromotions into select groups from RCMáté Szabó2024-10-311-1/+9
|/ | | | | | | | | | | | | | | | | | | | | Why: - The config variable $wgAutopromoteOnceLogInRC controls whether autopromotions show up in recent changes, but offers no granular controls beyond that. - In T377829, stewards have expressed interest in excluding certain spammy autopromote groups from recent changes. What: - Introduce and use a new config variable $wgAutopromoteOnceRCExcludedGroups that can be used to define a denylist of groups. Autopromotions into these groups will never result in an RC entry, as long as they were the only new groups the user was autopromoted into. Bug: T377829 Change-Id: Ia4942b09a5162749f24c8f674429fbf3f0459a0b
* Auth: pass accountType to authevents log streamPiotr Miazga2024-10-212-0/+17
| | | | | | | | | | | | | This should allow us to track which logins/account creations come from temp and named users. For convenience added a internal method in UserIdentityUtils to not copy paste same code all over again. Bug: T341650 Bug: T375510 Bug: T375505 Change-Id: I967d69a04c4435bb6b1398c94dbef91bde2022d3
* Merge "Use explicit nullable type on parameter arguments"jenkins-bot2024-10-167-19/+19
|\
| * Use explicit nullable type on parameter argumentsUmherirrender2024-10-167-19/+19
| | | | | | | | | | | | | | | | | | | | | | 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
* | Stop using heavy Language object when not neededAmir Sarabadani2024-10-161-5/+5
|/ | | | | | | Two easy cases, way more can be done. Bug: T376565 Change-Id: I3b875c4b6b2c2bdf7171a712898d50e26d86c807
* ConditionalDefaultsLookup: allow to dynamically add conditions for evaluationSergio Gimeno2024-10-162-1/+38
| | | | | | | | | | | | | | | | | | Why: To facilitate the evaluation of conditions not directly "known" by the lookup, eg: owned by extensions What: - Add ConditionalDefaultOptionsAddCondition hook which runs before instantiating ConditionalDefaultsLookup allowing to add conditions for evaluation in the $extraConditions array. - Evaluate the configured conditional default against the extra added conditions after evaluation of "known" conditions. Bug: T376918 Change-Id: Ife6f96397eafd61fdb40528aac315ddde1ef2774
* Merge "PasswordReset: Minor cleanup"jenkins-bot2024-10-141-10/+13
|\
| * PasswordReset: Minor cleanupReedy2024-10-101-10/+13
| | | | | | | | Change-Id: I684b1f25662b2689a0b14f532583322b002d6e02
* | Merge "user: Add a warning when creating cross-wiki users"jenkins-bot2024-10-111-0/+8
|\ \
| * | user: Add a warning when creating cross-wiki usersGergő Tisza2024-10-111-0/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | UserIdentity has a wiki property, but User does not implement it in a meaningful way so there's information loss when converting from UserIdentityValue to User (and on wiki farms where the same user can have different names on different wikis, we might even end up acting on the wrong user). Warn about it. Adds a new 'user' log channel, which is not ideal, but no existing channel seemed even remotely relevant. Change-Id: I895241b8823de9944ca212e538efbfd277bb1f8a
* | Merge "user: Take wiki into account when converting from UserIdentity"jenkins-bot2024-10-111-2/+4
|\ \ | |/ |/|
| * user: Take wiki into account when converting from UserIdentityGergő Tisza2024-10-111-2/+4
| | | | | | | | | | | | | | | | This might or might not be an improvement as User can't support cross-wiki objects anyway, but at least locally it is the right thing to do. Change-Id: I8a777a77aab448144defdceebe52d85f16d4e92a
* | Merge "Remove meaningless @var documentation from constants"jenkins-bot2024-10-094-12/+0
|\ \
| * | Remove meaningless @var documentation from constantsthiemowmde2024-10-094-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | A constant is not a variable. The type is hard-coded via the value and can never change. While the extra @var probably doesn't hurt much, it's redundant and error-prone and can't provide any additional information. Change-Id: Iee1f36a1905d9b9c6b26d0684b7848571f0c1733
* | | Merge "user: Add recursion guard to APCOND_BLOCKED check in UserGroupManager"jenkins-bot2024-10-091-3/+23
|\ \ \ | |/ / |/| |
| * | user: Add recursion guard to APCOND_BLOCKED check in UserGroupManagerVoidwalker2024-10-091-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is to prevent infinite recursion when checking APCOND_BLOCKED due to potentially repeated calls to user->getBlock. UserGroupManager::checkCondition now throws a LogicException when recursive behavior is detected during the APCOND_BLOCKED check. Bug: T349608 Change-Id: Ia55a4d27be0f583c3bc826661579cbb4e7c47881
* | | UserSelectQueryBuilder: temp() should not select non-temp usersGergő Tisza2024-10-071-1/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Add namespace to remaining parts of Wikimedia\ObjectCacheJames D. Forrester2024-09-271-1/+1
| | | | | | | | | | Bug: T353458 Change-Id: I3b736346550953e3b2977c14dc3eb10edc07cf97
* | Add namespace to IDBAccessObject and DBAccessObjectUtilsJames D. Forrester2024-09-2717-21/+22
| | | | | | | | | | Bug: T353458 Change-Id: I23cf7991f8792d4d000d1780463d8ce76dc0aee0
* | Add SpreadAnyEditBlock hookDreamy Jazz2024-09-241-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * A hook is needed which is called when User::spreadAnyEditBlock is called, so that extensions which provide alternative blocking mechanisims (such as the GlobalBlocking extension) can spread their blocks when local blocks are spread. What: * Add SpreadAnyEditBlockHook which is called from User ::spreadAnyEditBlock when it is called except when the user is not registered. ** The hook is called even if the user is not locally blocked * The return value of User::spreadAnyEditBlock is modified to return true if either a local block or alternative blocking mechanism spread blocks. * Update UserTest to test this new behaviour. Bug: T374857 Change-Id: Id302a6362d6177c89da9cdf4e677b3822ecb85f1
* | Allow extensions to send password resets without a local user/emailBartosz Dziewoński2024-09-162-34/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the checks for the existence of the user and the presence of their email address before the 'SpecialPasswordResetOnSubmit' hook, instead of after. This allows extensions to make their own decisions about whether a user exists or has email. This also means that extensions must now check the 'requireemail' preference when only the username is provided. They already had to check it when only the email was provided, so this seems more like a bug fix. To allow them to check this logic, if both the username and email were provided by the user, provide both of them to the hook. Bug: T151012 Change-Id: I6baf2c5194f981803198729f59e1e83d5644383a
* | Merge "Remove User::canExist()"jenkins-bot2024-09-161-17/+0
|\ \
| * | Remove User::canExist()Bartosz Dziewoński2024-09-101-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function has confusing semantics, mixing username validity, user existence, and whether the user is allowed to log in (isUsable()). The intended use case: "a central user exists and processing is being done with the user name, but the orresponding local user on a wiki may not yet have been created" is better served by the newly introduced CentralIdLookup::isOwned() in 49f4bab141d0. The method was added in the 1.43 release cycle in 074be0f04b13, so we can still remove it without deprecation or release notes. Depends-On: I800ce1bf1c9f5068168469768065834a8e03747f Change-Id: I5a36ee4f058476f7dabab0a36c44bc74c8a64d7a
* | | Merge "UserFactory: Use PHP type hints"jenkins-bot2024-09-121-24/+11
|\ \ \ | |/ / |/| |
| * | UserFactory: Use PHP type hintsFomafix2024-09-091-24/+11
| | | | | | | | | | | | | | | | | | | | | * Add PHP type hints where possible. * Remove @var, @param and @return if redundant to type declaration. Change-Id: I1253deb0b7a1b51e924e02d0ca47399839ac6f11
* | | UserOptionsManager: Allow global prefs for users without local accountsBartosz Dziewoński2024-09-102-11/+31
|/ / | | | | | | | | Bug: T371340 Change-Id: I5eba0fa558ad7f111988c17cfcee260c5a272baf
* | CentralIdLookup: Introduce concept of "owned" accountsBartosz Dziewoński2024-09-041-0/+17
| | | | | | | | | | Bug: T371340 Change-Id: Ia14f37ba24d1b750eced768d3e6eda86d597d494
* | PasswordReset: remove $wgAllowRequiringEmailForResets feature flagMusikAnimal2024-08-281-7/+3
| | | | | | | | | | | | | | | | | | Update a few tests that relied on the feature flag to ignore the 'requireemail' preference on "User1" to instead use "User2", who doesn't have the preference set. Bug: T242406 Change-Id: I996d3996272d704a071d1d2094c3568247b80f98
* | Make use of the ??= and ?? operators where it makes sensethiemowmde2024-08-262-6/+2
| | | | | | | | | | | | | | | | This touches various production classes and maintenance scripts. The code should do the exact same as before. The main benefit is that the syntax avoids any repetition. Change-Id: I5c552125469f4d7fb5b0fe494d198951b05eb35f
* | Merge "PasswordReset: Code quality improvements"jenkins-bot2024-08-232-48/+45
|\ \
| * | PasswordReset: Code quality improvementsBartosz Dziewoński2024-08-082-48/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Treat the username/email as provided when it's a falsy string ('0'). Refactor away some redundant checks and variables. Only construct User objects when needed for the hook. Documentation and code style tweaks. Change-Id: I499d73dacfb48a95291dcfa0405e52788a0251f4
* | | Move Language and friends into Language namespaceJames D. Forrester2024-08-104-6/+6
| | | | | | | | | | | | | | | Bug: T353458 Change-Id: Id3202c0c4f4a2043bf97b7caee081acab684155c