Update packages to do with karma
[lhc/web/wiklou.git] / maintenance / cleanupTable.inc
index f6259e9..0ddaf33 100644 (file)
@@ -49,11 +49,12 @@ class TableCleanup extends Maintenance {
 
        public function execute() {
                global $wgUser;
-               $wgUser = User::newFromName( 'Conversion script' );
                $this->dryrun = $this->hasOption( 'dry-run' );
                if ( $this->dryrun ) {
+                       $wgUser = User::newFromName( 'Conversion script' );
                        $this->output( "Checking for bad titles...\n" );
                } else {
+                       $wgUser = User::newSystemUser( 'Conversion script', array( 'steal' => true ) );
                        $this->output( "Checking and fixing bad titles...\n" );
                }
                $this->runTable( $this->defaultParams );
@@ -105,7 +106,7 @@ class TableCleanup extends Maintenance {
         * @throws MWException
         */
        public function runTable( $params ) {
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = $this->getDB( DB_SLAVE );
 
                if ( array_diff( array_keys( $params ),
                        array( 'table', 'conds', 'index', 'callback' ) )
@@ -171,10 +172,3 @@ class TableCleanup extends Maintenance {
                return sprintf( "\\x%02x", ord( $matches[1] ) );
        }
 }
-
-class TableCleanupTest extends TableCleanup {
-       function processRow( $row ) {
-               $this->progress( mt_rand( 0, 1 ) );
-       }
-}
-