Revert "Add type hint against LinkTarget"
[lhc/web/wiklou.git] / maintenance / migrateUserGroup.php
index 6903365..df6665a 100644 (file)
@@ -31,7 +31,7 @@ require_once __DIR__ . '/Maintenance.php';
 class MigrateUserGroup extends Maintenance {
        public function __construct() {
                parent::__construct();
-               $this->mDescription = "Re-assign users from an old group to a new one";
+               $this->addDescription( 'Re-assign users from an old group to a new one' );
                $this->addArg( 'oldgroup', 'Old user group key', true );
                $this->addArg( 'newgroup', 'New user group key', true );
                $this->setBatchSize( 200 );
@@ -41,7 +41,7 @@ class MigrateUserGroup extends Maintenance {
                $count = 0;
                $oldGroup = $this->getArg( 0 );
                $newGroup = $this->getArg( 1 );
-               $dbw = wfGetDB( DB_MASTER );
+               $dbw = $this->getDB( DB_MASTER );
                $start = $dbw->selectField( 'user_groups', 'MIN(ug_user)',
                        array( 'ug_group' => $oldGroup ), __FUNCTION__ );
                $end = $dbw->selectField( 'user_groups', 'MAX(ug_user)',
@@ -58,7 +58,7 @@ class MigrateUserGroup extends Maintenance {
                        $affected = 0;
                        $this->output( "Doing users $blockStart to $blockEnd\n" );
 
-                       $dbw->begin( __METHOD__ );
+                       $this->beginTransaction( $dbw, __METHOD__ );
                        $dbw->update( 'user_groups',
                                array( 'ug_group' => $newGroup ),
                                array( 'ug_group' => $oldGroup,
@@ -77,7 +77,7 @@ class MigrateUserGroup extends Maintenance {
                                __METHOD__
                        );
                        $affected += $dbw->affectedRows();
-                       $dbw->commit( __METHOD__ );
+                       $this->commitTransaction( $dbw, __METHOD__ );
 
                        // Clear cache for the affected users (bug 40340)
                        if ( $affected > 0 ) {