From: Tim Starling Date: Mon, 5 Jun 2006 05:21:12 +0000 (+0000) Subject: Script to update user_registration to an approximation, for old rows. X-Git-Tag: 1.31.0-rc.0~56895 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=7adbeb56156951c2ac37c45d9e13cc5c606f3996;p=lhc%2Fweb%2Fwiklou.git Script to update user_registration to an approximation, for old rows. --- diff --git a/maintenance/fixUserRegistration.php b/maintenance/fixUserRegistration.php new file mode 100644 index 0000000000..af8a68c2b0 --- /dev/null +++ b/maintenance/fixUserRegistration.php @@ -0,0 +1,31 @@ +select( 'user', 'user_id', 'user_registration IS NULL', $fname ); + +while ( $row = $dbr->fetchObject( $res ) ) { + $id = $row->user_id; + // Get first edit time + $timestamp = $dbr->selectField( 'revision', 'MIN(rev_timestamp)', array( 'rev_user' => $id ), $fname ); + // Update + if ( !empty( $timestamp ) ) { + $dbw->update( 'user', array( 'user_registration' => $timestamp ), array( 'user_id' => $id ), $fname ); + print "$id $timestamp\n"; + } else { + print "$id NULL\n"; + } +} +print "\n"; + +?>