Fix ORMRow::insert() on PostgreSQL.
[lhc/web/wiklou.git] / maintenance / convertUserOptions.php
index 5d76f85..e2223e1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Do each user sequentially, since accounts can't be deleted
+ * Convert user options to the new `user_properties` table.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * @ingroup Maintenance
  */
 
-require_once( dirname( __FILE__ ) . '/Maintenance.php' );
+require_once( __DIR__ . '/Maintenance.php' );
 
+/**
+ * Maintenance script to convert user options to the new `user_properties` table.
+ *
+ * Do each user sequentially, since accounts can't be deleted
+ *
+ * @ingroup Maintenance
+ */
 class ConvertUserOptions extends Maintenance {
 
        private $mConversionCount = 0;
@@ -33,12 +40,12 @@ class ConvertUserOptions extends Maintenance {
        }
 
        public function execute() {
-               $this->output( "Beginning batch conversion of user options.\n" );
+               $this->output( "...batch conversion of user_options: " );
                $id = 0;
                $dbw = wfGetDB( DB_MASTER );
 
                if ( !$dbw->fieldExists( 'user', 'user_options', __METHOD__ ) ) {
-                       $this->output( "No user_options field in the user table. Nothing to migrate..." );
+                       $this->output( "nothing to migrate. " );
                        return;
                }
                while ( $id !== null ) {
@@ -49,7 +56,7 @@ class ConvertUserOptions extends Maintenance {
                                array( 'LIMIT' => 50, 'FOR UPDATE' )
                        );
                        $id = $this->convertOptionBatch( $res, $dbw );
-                       $dbw->commit();
+                       $dbw->commit( __METHOD__ );
 
                        wfWaitForSlaves();
 
@@ -57,7 +64,7 @@ class ConvertUserOptions extends Maintenance {
                                $this->output( "--Converted to ID $id\n" );
                        }
                }
-               $this->output( "Conversion done. Converted " . $this->mConversionCount . " user records.\n" );
+               $this->output( "done. Converted " . $this->mConversionCount . " user records.\n" );
        }
 
        /**