Add a wfWaitForSlaves() call at the end of sql.php
[lhc/web/wiklou.git] / maintenance / fixUserRegistration.php
index 15c00b3..91d42a5 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @ingroup Maintenance
  */
 
-require_once( "Maintenance.php" );
+require_once( __DIR__ . '/Maintenance.php' );
 
+/**
+ * Maintenance script that fixes the user_registration field.
+ *
+ * @ingroup Maintenance
+ */
 class FixUserRegistration extends Maintenance {
        public function __construct() {
                parent::__construct();
@@ -35,7 +41,7 @@ class FixUserRegistration extends Maintenance {
 
                // Get user IDs which need fixing
                $res = $dbr->select( 'user', 'user_id', 'user_registration IS NULL', __METHOD__ );
-               while ( $row = $dbr->fetchObject( $res ) ) {
+               foreach ( $res as $row ) {
                        $id = $row->user_id;
                        // Get first edit time
                        $timestamp = $dbr->selectField( 'revision', 'MIN(rev_timestamp)', array( 'rev_user' => $id ), __METHOD__ );
@@ -52,4 +58,4 @@ class FixUserRegistration extends Maintenance {
 }
 
 $maintClass = "FixUserRegistration";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );