Index: trunk/extensions/CentralAuth/CentralAuth.php |
— | — | @@ -32,7 +32,13 @@ |
33 | 33 | */ |
34 | 34 | $wgCentralAuthStrict = false; |
35 | 35 | |
| 36 | +/** |
| 37 | + * If true, merging won't actually be possible through the Special:MergeAccount |
| 38 | + * interface. |
| 39 | + */ |
| 40 | +$wgCentralAuthDryRun = false; |
36 | 41 | |
| 42 | + |
37 | 43 | /** |
38 | 44 | * Initialization of the autoloaders, and special extension pages. |
39 | 45 | */ |
Index: trunk/extensions/CentralAuth/SpecialMergeAccount.php |
— | — | @@ -139,13 +139,17 @@ |
140 | 140 | |
141 | 141 | |
142 | 142 | function doDryRunMerge() { |
143 | | - global $wgUser, $wgRequest, $wgOut, $wgDBname; |
| 143 | + global $wgUser, $wgRequest, $wgOut, $wgDBname, $wgCentralAuthDryRun; |
144 | 144 | $globalUser = new CentralAuthUser( $wgUser->getName() ); |
145 | 145 | |
146 | 146 | if( $globalUser->exists() ) { |
147 | 147 | throw new MWException( "Already exists -- race condition" ); |
148 | 148 | } |
149 | 149 | |
| 150 | + if( $wgCentralAuthDryRun ) { |
| 151 | + $wgOut->addWikiText( wfMsg( 'centralauth-notice-dryrun' ) ); |
| 152 | + } |
| 153 | + |
150 | 154 | $password = $wgRequest->getVal( 'wpPassword' ); |
151 | 155 | if( $password != '' ) { |
152 | 156 | $this->addWorkingPassword( $password ); |
— | — | @@ -205,9 +209,13 @@ |
206 | 210 | } |
207 | 211 | |
208 | 212 | function doInitialMerge() { |
209 | | - global $wgUser, $wgRequest, $wgOut, $wgDBname; |
| 213 | + global $wgUser, $wgRequest, $wgOut, $wgDBname, $wgCentralAuthDryRun; |
210 | 214 | $globalUser = new CentralAuthUser( $wgUser->getName() ); |
211 | 215 | |
| 216 | + if( $wgCentralAuthDryRun ) { |
| 217 | + return $this->dryRunError(); |
| 218 | + } |
| 219 | + |
212 | 220 | if( $globalUser->exists() ) { |
213 | 221 | throw new MWException( "Already exists -- race condition" ); |
214 | 222 | } |
— | — | @@ -234,13 +242,16 @@ |
235 | 243 | } |
236 | 244 | |
237 | 245 | function doCleanupMerge() { |
238 | | - global $wgUser, $wgRequest, $wgOut, $wgDBname; |
| 246 | + global $wgUser, $wgRequest, $wgOut, $wgDBname, $wgCentralAuthDryRun; |
239 | 247 | $globalUser = new CentralAuthUser( $wgUser->getName() ); |
240 | 248 | |
241 | 249 | if( !$globalUser->exists() ) { |
242 | 250 | throw new MWException( "User doesn't exist -- race condition?" ); |
243 | 251 | } |
244 | 252 | |
| 253 | + if( $wgCentralAuthDryRun ) { |
| 254 | + return $this->dryRunError(); |
| 255 | + } |
245 | 256 | $password = $wgRequest->getText( 'wpPassword' ); |
246 | 257 | |
247 | 258 | $home = false; |
— | — | @@ -263,7 +274,12 @@ |
264 | 275 | } |
265 | 276 | |
266 | 277 | private function showWelcomeForm() { |
267 | | - global $wgOut, $wgUser; |
| 278 | + global $wgOut, $wgUser, $wgCentralAuthDryRun; |
| 279 | + |
| 280 | + if( $wgCentralAuthDryRun ) { |
| 281 | + $wgOut->addWikiText( wfMsg( 'centralauth-notice-dryrun' ) ); |
| 282 | + } |
| 283 | + |
268 | 284 | $wgOut->addWikiText( |
269 | 285 | wfMsg( 'centralauth-merge-welcome' ) . |
270 | 286 | "\n\n" . |
— | — | @@ -468,6 +484,11 @@ |
469 | 485 | ); |
470 | 486 | } |
471 | 487 | |
| 488 | + private function dryRunError() { |
| 489 | + global $wgOut; |
| 490 | + $wgOut->addWikiText( wfMsg( 'centralauth-disabled-dryrun' ) ); |
| 491 | + } |
| 492 | + |
472 | 493 | } |
473 | 494 | |
474 | 495 | |
Index: trunk/extensions/CentralAuth/CentralAuth.i18n.php |
— | — | @@ -97,6 +97,13 @@ |
98 | 98 | "\n" . |
99 | 99 | "If this is you, you can finish the login unification process " . |
100 | 100 | "simply by typing the master password for that account here:", |
| 101 | + |
| 102 | + 'centralauth-notice-dryrun' => |
| 103 | + "<div class='successbox'>Demo mode only</div><br clear='all'/>", |
| 104 | + |
| 105 | + 'centralauth-disabled-dryrun' => |
| 106 | + "Account unification is currently in a demo / debugging mode, " . |
| 107 | + "so actual merging operations are disabled. Sorry!", |
101 | 108 | |
102 | 109 | // Appended to various messages above |
103 | 110 | 'centralauth-readmore-text' => |