Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/183162
Change subject: sendConfirmAndMigrateEmail: Add --dryrun option, improve output
......................................................................
sendConfirmAndMigrateEmail: Add --dryrun option, improve output
Change-Id: Ia29ef1251d485c1c2f56e505bd67b66ae9a33733
---
M maintenance/sendConfirmAndMigrateEmail.php
1 file changed, 16 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth
refs/changes/62/183162/1
diff --git a/maintenance/sendConfirmAndMigrateEmail.php
b/maintenance/sendConfirmAndMigrateEmail.php
index 4ab7cef..748917f 100644
--- a/maintenance/sendConfirmAndMigrateEmail.php
+++ b/maintenance/sendConfirmAndMigrateEmail.php
@@ -33,6 +33,11 @@
*/
private $sleep;
+ /**
+ * @var bool
+ */
+ private $dryrun;
+
public function __construct() {
parent::__construct();
$this->mDescription = "Resends the 'confirm your email address
email' with a link to Special:MergeAccount";
@@ -45,11 +50,13 @@
$this->addOption( 'username', 'The user name to migrate',
false, true, 'u' );
$this->addOption( 'confirmed', 'Send email to confirmed
accounts', false, false );
$this->addOption( 'sleep', 'How long to wait in between
emails', false, true );
+ $this->addOption( 'dryrun', 'Don\'t actually send any emails',
false, false );
}
public function execute() {
$this->sendToConfirmed = $this->getOption( 'confirmed', false );
$this->sleep = $this->getOption( 'sleep', 1 );
+ $this->dryrun = $this->hasOption( 'dryrun');
// check to see if we are processing a single username
if ( $this->getOption( 'username', false ) !== false ) {
@@ -74,7 +81,9 @@
if ( $this->total % $this->batchSize == 0 ) {
$this->output( "Waiting for slaves to
catch up ... " );
- wfWaitForSlaves( false );
+ if ( !$this->dryrun ) {
+ wfWaitForSlaves( false );
+ }
$this->output( "done\n" );
}
}
@@ -121,7 +130,13 @@
return;
}
+ if ( $this->dryrun ) {
+ $this->output( "Would have sent email\n" );
+ return;
+ }
+
if ( $user->sendConfirmAndMigrateMail() ) {
+ $this->output( "Sent email to $username\n" );
$this->sent++;
sleep( $this->sleep );
} else {
--
To view, visit https://gerrit.wikimedia.org/r/183162
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia29ef1251d485c1c2f56e505bd67b66ae9a33733
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits