diff options
author | Alexander Vorwerk <zabe@avorwerk.net> | 2022-07-07 16:41:24 +0200 |
---|---|---|
committer | Zabe <zabe@avorwerk.net> | 2022-07-10 11:49:15 +0000 |
commit | 0b0be8bd7755c32adc24a0f2bf2177b18f47ab69 (patch) | |
tree | ca517ceb9ade659399f353bcefcaeff34c4dc5b8 /maintenance/createBotPassword.php | |
parent | 52bf11384cc5d07ff8b8ffecdcb504dd6328ede0 (diff) | |
download | mediawikicore-0b0be8bd7755c32adc24a0f2bf2177b18f47ab69.tar.gz mediawikicore-0b0be8bd7755c32adc24a0f2bf2177b18f47ab69.zip |
Use GrantsInfo and GrantsLocalization instead of MWGrants
MWGrants is deprecated and should be replaced with the GrantsInfo and
the GrantsLocalization services.
Bug: T253077
Change-Id: Ic73d98bc014ff46fc5d80e93db7de4bb18d84ae2
Diffstat (limited to 'maintenance/createBotPassword.php')
-rw-r--r-- | maintenance/createBotPassword.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/maintenance/createBotPassword.php b/maintenance/createBotPassword.php index 3cb1c4c0c6e2..e7bc4ca42568 100644 --- a/maintenance/createBotPassword.php +++ b/maintenance/createBotPassword.php @@ -24,6 +24,8 @@ require_once __DIR__ . '/Maintenance.php'; +use MediaWiki\MediaWikiServices; + class CreateBotPassword extends Maintenance { /** * Width of initial column of --showgrants output @@ -80,7 +82,9 @@ class CreateBotPassword extends Maintenance { $this->fatalError( implode( "\n", $errors ) ); } - $invalidGrants = array_diff( $grants, MWGrants::getValidGrants() ); + $services = MediaWikiServices::getInstance(); + $grantsInfo = $services->getGrantsInfo(); + $invalidGrants = array_diff( $grants, $grantsInfo->getValidGrants() ); if ( count( $invalidGrants ) > 0 ) { $this->fatalError( "These grants are invalid: " . implode( ', ', $invalidGrants ) . "\n" . @@ -88,7 +92,7 @@ class CreateBotPassword extends Maintenance { ); } - $passwordFactory = MediaWiki\MediaWikiServices::getInstance()->getPasswordFactory(); + $passwordFactory = $services->getPasswordFactory(); $userId = User::idFromName( $username ); if ( $userId === null ) { @@ -131,7 +135,7 @@ class CreateBotPassword extends Maintenance { } public function showGrants() { - $permissions = MWGrants::getValidGrants(); + $permissions = MediaWikiServices::getInstance()->getGrantsInfo()->getValidGrants(); sort( $permissions ); $this->output( str_pad( 'GRANT', self::SHOWGRANTS_COLUMN_WIDTH ) . " DESCRIPTION\n" ); |