X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FuserOptions.inc;h=99ba3b8329ca6c7773bbfa0abb934911e8f665e4;hb=e59e1e3c3b39642b6102567a23456cfc14b52ea7;hp=f497f2aeca13b629469b37c59d3dd3a80b9e8f4a;hpb=1a533fa0ccdd1ed28e76a89951b9d56c473fa417;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/userOptions.inc b/maintenance/userOptions.inc index f497f2aeca..99ba3b8329 100644 --- a/maintenance/userOptions.inc +++ b/maintenance/userOptions.inc @@ -40,7 +40,11 @@ class UserOptions { private $mMode, $mReady; - /** Constructor. Will show usage and exit if script options are not correct */ + /** + * Constructor. Will show usage and exit if script options are not correct + * @param array $opts + * @param array $args + */ function __construct( $opts, $args ) { if ( !$this->checkOpts( $opts, $args ) ) { UserOptions::showUsageAndExit(); @@ -52,8 +56,8 @@ class UserOptions { /** * This is used to check options. Only needed on construction * - * @param $opts array - * @param $args array + * @param array $opts + * @param array $args * * @return bool */ @@ -72,8 +76,8 @@ class UserOptions { /** * load script options in the object * - * @param $opts array - * @param $args array + * @param array $opts + * @param array $args * * @return bool */ @@ -107,7 +111,8 @@ class UserOptions { return false; } - $this->{ $this->mMode } (); + $this->{$this->mMode}(); + return true; } @@ -139,7 +144,7 @@ class UserOptions { array( 'user_id' ), array(), __METHOD__ - ); + ); foreach ( $result as $id ) { @@ -155,15 +160,18 @@ class UserOptions { $userValue = $user->getOption( $this->mAnOption ); if ( $userValue <> $defaultOptions[$this->mAnOption] ) { + // @codingStandardsIgnoreStart Ignore silencing errors is discouraged warning @$ret[$this->mAnOption][$userValue]++; + // @codingStandardsIgnoreEnd } - } else { foreach ( $defaultOptions as $name => $defaultValue ) { $userValue = $user->getOption( $name ); if ( $userValue <> $defaultValue ) { + // @codingStandardsIgnoreStart Ignore silencing errors is discouraged warning @$ret[$name][$userValue]++; + // @codingStandardsIgnoreEnd } } } @@ -188,7 +196,7 @@ class UserOptions { array( 'user_id' ), array(), __METHOD__ - ); + ); foreach ( $result as $id ) { @@ -200,7 +208,8 @@ class UserOptions { if ( $curValue == $this->mOldValue ) { if ( !$this->mQuiet ) { - print "Setting {$this->mAnOption} for $username from '{$this->mOldValue}' to '{$this->mNewValue}'): "; + print "Setting {$this->mAnOption} for $username from '{$this->mOldValue}' " . + "to '{$this->mNewValue}'): "; } // Change value @@ -213,7 +222,6 @@ class UserOptions { if ( !$this->mQuiet ) { print " OK\n"; } - } elseif ( !$this->mQuiet ) { print "Not changing '$username' using <{$this->mAnOption}> = '$curValue'\n"; } @@ -230,6 +238,7 @@ class UserOptions { foreach ( $def as $optname => $defaultValue ) { array_push( $ret, $optname ); } + return $ret; } @@ -238,7 +247,7 @@ class UserOptions { # public static function showUsageAndExit() { -print <<mAnOption> = '$this->mOldValue' will be made to use '$this->mNewValue'. Abort with control-c in the next five seconds.... WARN; wfCountDown( 5 ); + return true; } - }