<?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;
}
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 ) {
array( 'LIMIT' => 50, 'FOR UPDATE' )
);
$id = $this->convertOptionBatch( $res, $dbw );
- $dbw->commit();
+ $dbw->commit( __METHOD__ );
wfWaitForSlaves();
$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" );
}
/**