diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-06-22 11:28:20 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-06-22 11:28:20 +0200 |
commit | 9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch) | |
tree | 46d1a0dee7febef5c2d57a9f7b972be16a163b3d /maintenance/convertUserOptions.php | |
parent | 78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff) |
update to MediaWiki 1.17.0
Diffstat (limited to 'maintenance/convertUserOptions.php')
-rw-r--r-- | maintenance/convertUserOptions.php | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/maintenance/convertUserOptions.php b/maintenance/convertUserOptions.php index 657a82c1..278d40ff 100644 --- a/maintenance/convertUserOptions.php +++ b/maintenance/convertUserOptions.php @@ -17,10 +17,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * + * @file * @ingroup Maintenance */ -require_once( dirname(__FILE__) . '/Maintenance.php' ); +require_once( dirname( __FILE__ ) . '/Maintenance.php' ); class ConvertUserOptions extends Maintenance { @@ -30,24 +31,24 @@ class ConvertUserOptions extends Maintenance { parent::__construct(); $this->mDescription = "Convert user options from old to new system"; } - + public function execute() { $this->output( "Beginning batch conversion of user options.\n" ); $id = 0; $dbw = wfGetDB( DB_MASTER ); - while ($id !== null) { - $idCond = 'user_id>'.$dbw->addQuotes( $id ); - $optCond = "user_options!=".$dbw->addQuotes( '' ); // For compatibility + while ( $id !== null ) { + $idCond = 'user_id>' . $dbw->addQuotes( $id ); + $optCond = "user_options!=" . $dbw->addQuotes( '' ); // For compatibility $res = $dbw->select( 'user', '*', array( $optCond, $idCond ), __METHOD__, array( 'LIMIT' => 50, 'FOR UPDATE' ) ); $id = $this->convertOptionBatch( $res, $dbw ); $dbw->commit(); - + wfWaitForSlaves( 1 ); - - if ($id) + + if ( $id ) $this->output( "--Converted to ID $id\n" ); } $this->output( "Conversion done. Converted " . $this->mConversionCount . " user records.\n" ); @@ -57,16 +58,16 @@ class ConvertUserOptions extends Maintenance { $id = null; foreach ( $res as $row ) { $this->mConversionCount++; - + $u = User::newFromRow( $row ); - + $u->saveSettings(); $id = $row->user_id; } - + return $id; } } $maintClass = "ConvertUserOptions"; -require_once( DO_MAINTENANCE ); +require_once( RUN_MAINTENANCE_IF_MAIN ); |