Index: trunk/phase3/maintenance/resetUserTokens.php |
— | — | @@ -30,21 +30,16 @@ |
31 | 31 | parent::__construct(); |
32 | 32 | $this->mDescription = "Reset the user_token of all users on the wiki. Note that this may log some of them out."; |
33 | 33 | $this->addOption( 'nowarn', "Hides the 5 seconds warning", false, false ); |
34 | | - $this->addOption( 'quiet', "Do not print what is happening", false, false ); |
35 | 34 | } |
36 | 35 | |
37 | 36 | public function execute() { |
38 | | - $nowarn = $this->getOption( 'nowarn' ); |
39 | | - $quiet = $this->getOption( 'quiet' ); |
40 | 37 | |
41 | | - if ( !$nowarn ) { |
42 | | - echo <<<WARN |
43 | | -The script is about to reset the user_token for ALL USERS in the database. |
44 | | -This may log some of them out and is not necessary unless you believe your |
45 | | -user table has been compromised. |
46 | | - |
47 | | -Abort with control-c in the next five seconds.... |
48 | | -WARN; |
| 38 | + if ( !$this->getOption( 'nowarn' ) ) { |
| 39 | + $this->output( "The script is about to reset the user_token for ALL USERS in the database.\n" ); |
| 40 | + $this->output( "This may log some of them out and is not necessary unless you believe your\n" ); |
| 41 | + $this->output( "user table has been compromised.\n" ); |
| 42 | + $this->output( "\n" ); |
| 43 | + $this->output( "Abort with control-c in the next five seconds (skip this countdown with --nowarn) ... " ); |
49 | 44 | wfCountDown( 5 ); |
50 | 45 | } |
51 | 46 | |
— | — | @@ -61,17 +56,13 @@ |
62 | 57 | |
63 | 58 | $username = $user->getName(); |
64 | 59 | |
65 | | - if ( !$quiet ) { |
66 | | - echo "Resetting user_token for $username: "; |
67 | | - } |
| 60 | + $this->output( "Resetting user_token for $username: " ); |
68 | 61 | |
69 | 62 | // Change value |
70 | 63 | $user->setToken(); |
71 | 64 | $user->saveSettings(); |
72 | 65 | |
73 | | - if ( !$quiet ) { |
74 | | - echo " OK\n"; |
75 | | - } |
| 66 | + $this->output( " OK\n" ); |
76 | 67 | |
77 | 68 | } |
78 | 69 | |