One less $wgTitle, and use dbw->update() instead of raw sql
[lhc/web/wiklou.git] / maintenance / userOptions.inc
index bfc8e8e..deb12bc 100644 (file)
@@ -83,7 +83,7 @@ class userOptions {
 
        #
        # Modes.
-       # 
+       #
 
        /** List default options and their value */
        private function LISTER( ) {
@@ -111,7 +111,7 @@ class userOptions {
                        __METHOD__
                        );
 
-               while ( $id = $dbr->fetchObject( $result ) ) {
+               foreach ( $result as $id ) {
 
                        $user = User::newFromId( $id->user_id );
 
@@ -161,7 +161,7 @@ class userOptions {
                        __METHOD__
                        );
 
-               while ( $id = $dbr->fetchObject( $result ) ) {
+               foreach ( $result as $id ) {
 
                        $user = User::newFromId( $id->user_id );
 
@@ -174,7 +174,7 @@ class userOptions {
                                        print "Setting {$this->mAnOption} for $username from '{$this->mOldValue}' to '{$this->mNewValue}'): ";
                                }
 
-                               // Change value 
+                               // Change value
                                $user->setOption( $this->mAnOption, $this->mNewValue );
 
                                // Will not save the settings if run with --dry
@@ -212,25 +212,25 @@ This script pass through all users and change one of their options.
 The new option is NOT validated.
 
 Usage:
-    php userOptions.php --list
-    php userOptions.php [user option] --usage
-    php userOptions.php [options] <user option> --old <old value> --new <new value>
+       php userOptions.php --list
+       php userOptions.php [user option] --usage
+       php userOptions.php [options] <user option> --old <old value> --new <new value>
 
 Switchs:
-    --list : list available user options and their default value
+       --list : list available user options and their default value
 
-    --usage : report all options statistics or just one if you specify it.
+       --usage : report all options statistics or just one if you specify it.
 
-    --old <old value> : the value to look for
-    --new <new value> : new value to update users with
+       --old <old value> : the value to look for
+       --new <new value> : new value to update users with
 
 Options:
-    --nowarn: hides the 5 seconds warning
-    --quiet : do not print what is happening
-    --dry   : do not save user settings back to database
+       --nowarn: hides the 5 seconds warning
+       --quiet : do not print what is happening
+       --dry   : do not save user settings back to database
 
 USAGE;
-    exit( 0 );
+       exit( 0 );
        }
 
        /** The warning message and countdown */