jenkins-bot has submitted this change and it was merged. Change subject: LocalRenameUserJob: In force mode, bypass all Title/User validation ......................................................................
LocalRenameUserJob: In force mode, bypass all Title/User validation Just hit the DB directly when dealing with invalid usernames, and use User::newFromRow() which does no validation/normalization. Change-Id: Ida452110c95b2d5d785ad4ef8ec4d891bbf27cf1 (cherry picked from commit 2f9e4550c1a6561e1d2a655105bbd9591a544b2f) --- M includes/LocalRenameJob/LocalRenameUserJob.php 1 file changed, 11 insertions(+), 4 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/LocalRenameJob/LocalRenameUserJob.php b/includes/LocalRenameJob/LocalRenameUserJob.php index 3f93ac6..fea5825 100644 --- a/includes/LocalRenameJob/LocalRenameUserJob.php +++ b/includes/LocalRenameJob/LocalRenameUserJob.php @@ -39,11 +39,18 @@ $callback = RequestContext::importScopedSession( $this->params['session'] ); } - $oldUser = User::newFromName( $from ); if ( isset( $this->params['force'] ) && $this->params['force'] ) { - // Forcibly set the username, don't validate it at all in case we're renaming - // someone with an invalid username - $oldUser->mName = $from; + // If we're dealing with an invalid username, load the data ourselves to avoid + // any normalization at all done by User or Title. + $row = wfGetDB( DB_MASTER )->selectRow( + 'user', + User::selectFields(), + array( 'user_name' => $from ), + __METHOD__ + ); + $oldUser = User::newFromRow( $row ); + } else { + $oldUser = User::newFromName( $from ); } $rename = new RenameuserSQL( -- To view, visit https://gerrit.wikimedia.org/r/204948 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ida452110c95b2d5d785ad4ef8ec4d891bbf27cf1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CentralAuth Gerrit-Branch: wmf/1.26wmf2 Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits