00001 <?php
00010 require_once( 'commandLine.inc' );
00011
00012 $fname = 'fixUserRegistration.php';
00013
00014 $dbr = wfGetDB( DB_SLAVE );
00015 $dbw = wfGetDB( DB_MASTER );
00016
00017
00018 $res = $dbr->select( 'user', 'user_id', 'user_registration IS NULL', $fname );
00019
00020 while ( $row = $dbr->fetchObject( $res ) ) {
00021 $id = $row->user_id;
00022
00023 $timestamp = $dbr->selectField( 'revision', 'MIN(rev_timestamp)', array( 'rev_user' => $id ), $fname );
00024
00025 if ( !empty( $timestamp ) ) {
00026 $dbw->update( 'user', array( 'user_registration' => $timestamp ), array( 'user_id' => $id ), $fname );
00027 print "$id $timestamp\n";
00028 } else {
00029 print "$id NULL\n";
00030 }
00031 }
00032 print "\n";
00033
00034