summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Evans <grknight@gentoo.org>2022-09-27 18:53:03 -0400
committerBrian Evans <grknight@gentoo.org>2022-09-27 19:02:02 -0400
commit5ca8d30155e11d97b20f79acec40632c2e06fcd5 (patch)
tree7531fb116791f8328c0bb0cabe42265ca67e6df9 /MLEB/UniversalLanguageSelector/includes/api
parentMerge branch 'master' into wikitest (diff)
downloadextensions-5ca8d30155e11d97b20f79acec40632c2e06fcd5.tar.gz
extensions-5ca8d30155e11d97b20f79acec40632c2e06fcd5.tar.bz2
extensions-5ca8d30155e11d97b20f79acec40632c2e06fcd5.zip
Update MLEB to 2021.12v1.35.2
This is the final version for MW 1.35 Signed-off-by: Brian Evans <grknight@gentoo.org>
Diffstat (limited to 'MLEB/UniversalLanguageSelector/includes/api')
-rw-r--r--MLEB/UniversalLanguageSelector/includes/api/ApiULSSetLanguage.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/MLEB/UniversalLanguageSelector/includes/api/ApiULSSetLanguage.php b/MLEB/UniversalLanguageSelector/includes/api/ApiULSSetLanguage.php
index 715c6dd8..7d7717e9 100644
--- a/MLEB/UniversalLanguageSelector/includes/api/ApiULSSetLanguage.php
+++ b/MLEB/UniversalLanguageSelector/includes/api/ApiULSSetLanguage.php
@@ -18,10 +18,29 @@
* @license MIT
*/
+use MediaWiki\User\UserOptionsManager;
+
/**
* @ingroup API
*/
class ApiULSSetLanguage extends ApiBase {
+ /** @var UserOptionsManager */
+ private $userOptionsManager;
+
+ /**
+ * @param ApiMain $main
+ * @param string $action
+ * @param UserOptionsManager $userOptionsManager
+ */
+ public function __construct(
+ ApiMain $main,
+ $action,
+ UserOptionsManager $userOptionsManager
+ ) {
+ parent::__construct( $main, $action );
+ $this->userOptionsManager = $userOptionsManager;
+ }
+
public function execute() {
$request = $this->getRequest();
if ( !$request->wasPosted() ) {
@@ -53,9 +72,10 @@ class ApiULSSetLanguage extends ApiBase {
}
$updateUser = $user->getInstanceForUpdate();
- $updateUser->setOption( 'language', $languageCode );
+ // @phan-suppress-next-line SecurityCheck-SQLInjection False positive caused by T290563
+ $this->userOptionsManager->setOption( $updateUser, 'language', $languageCode );
// Sync the DB on post-send
- DeferredUpdates::addCallableUpdate( function () use ( $updateUser ) {
+ DeferredUpdates::addCallableUpdate( static function () use ( $updateUser ) {
$updateUser->saveSettings();
} );
}