X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcreateAndPromote.php;h=da9b4d63a0b3f534f36483d16b1c71883583b972;hb=1cc50ab8f5f94c753781a875fa91e9fea7a9dcc9;hp=24ab3d21fc72a1cb8c1e7b3e86365b63e5c5c105;hpb=93350da7f1ab397b87c3ac3073ddfc1c857b272e;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/createAndPromote.php b/maintenance/createAndPromote.php index 24ab3d21fc..da9b4d63a0 100644 --- a/maintenance/createAndPromote.php +++ b/maintenance/createAndPromote.php @@ -103,18 +103,26 @@ class CreateAndPromote extends Maintenance { return; } elseif ( count( $promotions ) !== 0 ) { + $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId(); $promoText = "User:{$username} into " . implode( ', ', $promotions ) . "...\n"; if ( $exists ) { - $this->output( wfWikiID() . ": Promoting $promoText" ); + $this->output( "$dbDomain: Promoting $promoText" ); } else { - $this->output( wfWikiID() . ": Creating and promoting $promoText" ); + $this->output( "$dbDomain: Creating and promoting $promoText" ); } } if ( !$exists ) { - # Insert the account into the database - $user->addToDatabase(); - $user->saveSettings(); + // Create the user via AuthManager as there may be various side + // effects that are perfomed by the configured AuthManager chain. + $status = MediaWiki\Auth\AuthManager::singleton()->autoCreateUser( + $user, + MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_MAINT, + false + ); + if ( !$status->isGood() ) { + $this->fatalError( $status->getWikiText( null, null, 'en' ) ); + } } if ( $password ) { @@ -142,7 +150,7 @@ class CreateAndPromote extends Maintenance { if ( !$exists ) { # Increment site_stats.ss_users - $ssu = new SiteStatsUpdate( 0, 0, 0, 0, 1 ); + $ssu = SiteStatsUpdate::factory( [ 'users' => 1 ] ); $ssu->doUpdate(); }