From 7adbeb56156951c2ac37c45d9e13cc5c606f3996 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 5 Jun 2006 05:21:12 +0000 Subject: [PATCH] Script to update user_registration to an approximation, for old rows. --- maintenance/fixUserRegistration.php | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 maintenance/fixUserRegistration.php 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"; + +?> -- 2.20.1