r24591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24590‎ | r24591 | r24592 >
Date:16:54, 4 August 2007
Author:brion
Status:old
Tags:
Comment:
dry run mode for demoing and live testing
Modified paths:
  • /trunk/extensions/CentralAuth/CentralAuth.i18n.php (modified) (history)
  • /trunk/extensions/CentralAuth/CentralAuth.php (modified) (history)
  • /trunk/extensions/CentralAuth/SpecialMergeAccount.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralAuth/CentralAuth.php
@@ -32,7 +32,13 @@
3333 */
3434 $wgCentralAuthStrict = false;
3535
 36+/**
 37+ * If true, merging won't actually be possible through the Special:MergeAccount
 38+ * interface.
 39+ */
 40+$wgCentralAuthDryRun = false;
3641
 42+
3743 /**
3844 * Initialization of the autoloaders, and special extension pages.
3945 */
Index: trunk/extensions/CentralAuth/SpecialMergeAccount.php
@@ -139,13 +139,17 @@
140140
141141
142142 function doDryRunMerge() {
143 - global $wgUser, $wgRequest, $wgOut, $wgDBname;
 143+ global $wgUser, $wgRequest, $wgOut, $wgDBname, $wgCentralAuthDryRun;
144144 $globalUser = new CentralAuthUser( $wgUser->getName() );
145145
146146 if( $globalUser->exists() ) {
147147 throw new MWException( "Already exists -- race condition" );
148148 }
149149
 150+ if( $wgCentralAuthDryRun ) {
 151+ $wgOut->addWikiText( wfMsg( 'centralauth-notice-dryrun' ) );
 152+ }
 153+
150154 $password = $wgRequest->getVal( 'wpPassword' );
151155 if( $password != '' ) {
152156 $this->addWorkingPassword( $password );
@@ -205,9 +209,13 @@
206210 }
207211
208212 function doInitialMerge() {
209 - global $wgUser, $wgRequest, $wgOut, $wgDBname;
 213+ global $wgUser, $wgRequest, $wgOut, $wgDBname, $wgCentralAuthDryRun;
210214 $globalUser = new CentralAuthUser( $wgUser->getName() );
211215
 216+ if( $wgCentralAuthDryRun ) {
 217+ return $this->dryRunError();
 218+ }
 219+
212220 if( $globalUser->exists() ) {
213221 throw new MWException( "Already exists -- race condition" );
214222 }
@@ -234,13 +242,16 @@
235243 }
236244
237245 function doCleanupMerge() {
238 - global $wgUser, $wgRequest, $wgOut, $wgDBname;
 246+ global $wgUser, $wgRequest, $wgOut, $wgDBname, $wgCentralAuthDryRun;
239247 $globalUser = new CentralAuthUser( $wgUser->getName() );
240248
241249 if( !$globalUser->exists() ) {
242250 throw new MWException( "User doesn't exist -- race condition?" );
243251 }
244252
 253+ if( $wgCentralAuthDryRun ) {
 254+ return $this->dryRunError();
 255+ }
245256 $password = $wgRequest->getText( 'wpPassword' );
246257
247258 $home = false;
@@ -263,7 +274,12 @@
264275 }
265276
266277 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+
268284 $wgOut->addWikiText(
269285 wfMsg( 'centralauth-merge-welcome' ) .
270286 "\n\n" .
@@ -468,6 +484,11 @@
469485 );
470486 }
471487
 488+ private function dryRunError() {
 489+ global $wgOut;
 490+ $wgOut->addWikiText( wfMsg( 'centralauth-disabled-dryrun' ) );
 491+ }
 492+
472493 }
473494
474495
Index: trunk/extensions/CentralAuth/CentralAuth.i18n.php
@@ -97,6 +97,13 @@
9898 "\n" .
9999 "If this is you, you can finish the login unification process " .
100100 "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!",
101108
102109 // Appended to various messages above
103110 'centralauth-readmore-text' =>

Status & tagging log