<?php
+/**
+ * @file
+ * @ingroup Maintenance
+ */
+
// Options we will use
$options = array( 'list', 'nowarn', 'quiet', 'usage', 'dry' );
$optionsWithArgs = array( 'old', 'new' );
-require_once( 'commandLine.inc' );
+require_once( dirname(__FILE__) . '/commandLine.inc' );
+/**
+ * @ingroup Maintenance
+ */
class userOptions {
public $mQuick;
public $mQuiet;
$user = User::newFromId( $id->user_id );
// Get the options and update stats
- foreach( $defaultOptions as $name => $defaultValue ) {
- $userValue = $user->getOption( $name );
- if( $userValue <> $defaultValue ) {
- @$ret[$name][$userValue]++;
+ if( $this->mAnOption ) {
+
+ if(!array_key_exists( $this->mAnOption, $defaultOptions ) ) {
+ print "Invalid user option. Use --list to see valid choices\n";
+ exit;
+ }
+
+ $userValue = $user->getOption( $this->mAnOption );
+ if( $userValue <> $defaultOptions[$this->mAnOption] ) {
+ @$ret[$this->mAnOption][$userValue]++;
+ }
+
+ } else {
+
+ foreach( $defaultOptions as $name => $defaultValue ) {
+ $userValue = $user->getOption( $name );
+ if( $userValue <> $defaultValue ) {
+ @$ret[$name][$userValue]++;
+ }
}
}
}
Usage:
php userOptions.php --list
- php userOptions.php <user option> --usage
+ 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
- --usage <option name> : report statistics about an option
+ --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
Abort with control-c in the next five seconds....
WARN;
- require('counter.php');
- for ($i=6;$i>=1;) {
- print_c($i, --$i);
- sleep(1);
- }
- print "\n";
-
+ wfCountDown( 5 );
return true;
}
}
-?>