jenkins-bot has submitted this change and it was merged.

Change subject: Kill old election/vote scripts
......................................................................


Kill old election/vote scripts

Change-Id: Iefc6062fa5062e340378d7825a1dc11186465755
---
D cli/wm-scripts/arbcom/makeArbcomList.php
D cli/wm-scripts/bv2009/bv2009_tables.sql
D cli/wm-scripts/bv2009/dumpMetaTranslations.php
D cli/wm-scripts/bv2009/populateBv2009EditCount.php
D cli/wm-scripts/bv2009/voterList-bv2009.php
D cli/wm-scripts/elections-2011-spam/buildSpamTranslations.php
D cli/wm-scripts/elections-2011-spam/doSpam.php
D cli/wm-scripts/elections-2011-spam/get-voter-list.sh
D cli/wm-scripts/elections-2011-spam/sendMails.php
9 files changed, 0 insertions(+), 737 deletions(-)

Approvals:
  Reedy: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/cli/wm-scripts/arbcom/makeArbcomList.php 
b/cli/wm-scripts/arbcom/makeArbcomList.php
deleted file mode 100644
index 0575ca3..0000000
--- a/cli/wm-scripts/arbcom/makeArbcomList.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-/**
- * Like makeSimpleList.php except with edits limited to the main namespace
- */
-
-$optionsWithArgs = array( 'before', 'edits' );
-require( dirname(__FILE__).'/../../cli.inc' );
-
-$dbr = wfGetDB( DB_SLAVE );
-$dbw = wfGetDB( DB_MASTER );
-$fname = 'voterList.php';
-$before = isset( $options['before'] ) ? $dbr->timestamp( strtotime( 
$options['before'] ) ) : false;
-$minEdits = isset( $options['edits'] ) ? intval( $options['edits'] ) : false;
-
-if ( !isset( $args[0] ) ) {
-       echo "Usage: php voterList.php [--replace] [--before=<date>] 
[--edits=<date>] <name>\n";
-       exit( 1 );
-}
-$listName = $args[0];
-$startBatch = 0;
-$batchSize = 100;
-
-$listExists = $dbr->selectField( 'securepoll_lists', '1',
-       array( 'li_name' => $listName ), $fname );
-if ( $listExists ) {
-       if ( isset( $options['replace'] ) ) {
-               echo "Deleting existing list...\n";
-               $dbw->delete( 'securepoll_lists', array( 'li_name' => $listName 
), $fname );
-       } else {
-               echo "Error: list exists. Use --replace to replace it.\n";
-               exit( 1 );
-       }
-}
-
-while ( true ) {
-       $res = $dbr->select( 'user', 'user_id',
-               array( 'user_id > ' . $dbr->addQuotes( $startBatch ) ),
-               $fname,
-               array( 'LIMIT' => $batchSize ) );
-
-       if ( !$res->numRows() ) {
-               break;
-       }
-
-       $insertBatch = array();
-       foreach ( $res as $row ) {
-               $startBatch = $userId = $row->user_id;
-               $insertRow = array( 'li_name' => $listName, 'li_member' => 
$userId );
-               if ( $minEdits === false ) {
-                       $insertBatch[] = $insertRow;
-                       continue;
-               }
-
-               # Count edits
-               $conds = array( 'rev_user' => $userId );
-               if ( $before !== false ) {
-                       $conds[] = 'rev_timestamp < ' . $dbr->addQuotes( 
$before );
-               }
-               $conds[] = 'page_id=rev_page';
-               $conds['page_namespace'] = 0;
-               $edits = $dbr->selectField( array( 'page', 'revision' ), 
'COUNT(*)', $conds, $fname );
-               if ( $edits >= $minEdits ) {
-                       $insertBatch[] = $insertRow;
-               }
-       }
-       if ( $insertBatch ) {
-               $dbw->insert( 'securepoll_lists', $insertBatch, $fname );
-       }
-}
diff --git a/cli/wm-scripts/bv2009/bv2009_tables.sql 
b/cli/wm-scripts/bv2009/bv2009_tables.sql
deleted file mode 100644
index 714b0b4..0000000
--- a/cli/wm-scripts/bv2009/bv2009_tables.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-CREATE TABLE bv2009_edits (
-       bv_user int not null primary key,
-       bv_long_edits int not null,
-       bv_short_edits int not null
-);
diff --git a/cli/wm-scripts/bv2009/dumpMetaTranslations.php 
b/cli/wm-scripts/bv2009/dumpMetaTranslations.php
deleted file mode 100644
index 4644840..0000000
--- a/cli/wm-scripts/bv2009/dumpMetaTranslations.php
+++ /dev/null
@@ -1,202 +0,0 @@
-<?php
-
-require( dirname( __FILE__ ) . '/../../cli.inc' );
-
-$spConf = array(
-       'numCandidates' => 18,
-       'baseId' => 17,
-       'basePage' => 'Board elections/2009/Vote interface',
-       'langs' => array(
-               'ar',
-               'bn',
-               'ca',
-               'cs',
-               'da',
-               'de',
-               'el',
-               'en',
-               'eo',
-               'es',
-               'fi',
-               'fr',
-               'gl',
-               'hi',
-               'hr',
-               'hu',
-               'ia',
-               'id',
-               'it',
-               'ja',
-               'jv',
-               'ko',
-               'ksh',
-               'ms',
-               'nb',
-               'nl',
-               'oc',
-               'pl',
-               'pt',
-               'pt-br',
-               'ru',
-               'sk',
-               'sv',
-               'tr',
-               'uk',
-               'vi',
-               'zh-hans',
-               'zh-hant',
-       )
-);
-
-$header = <<<EOT
-<SecurePoll>
-<election>
-<configuration>
-<title>Wikimedia Board of Trustees Election, 2009</title>
-<ballot>preferential</ballot>
-<tally>schulze</tally>
-<primaryLang>en</primaryLang>
-<startDate>2009-07-28T12:00:00Z</startDate>
-<endDate>2009-08-10T23:59:59Z</endDate>
-<auth>remote-mw</auth>
-<id>{$spConf['baseId']}</id>
-<property name="admins">Tim 
Starling|Philippe|Werdna|Daniel|Yann|Mardetanha</property>
-<property name="not-blocked">1</property>
-<property name="not-bot">1</property>
-<property name="need-list">board-vote-2009</property>
-<property name="encrypt-type">gpg</property>
-<property 
name="remote-mw-script-path">https://secure.wikimedia.org/\$site/\$lang/w</property>
-<property name="shuffle-options">1</property>
-<property name="gpg-encrypt-key"><!-- insert key here --></property>
-<property name="gpg-sign-key"><!-- insert key here --></property>
-
-
-EOT;
-
-$allMessages = array();
-foreach ( $spConf['langs'] as $lang ) {
-       $messages = spGetMetaTranslations( $lang );
-       if ( $messages ) {
-               $allMessages[$lang] = $messages;
-       } else {
-               fwrite( STDERR, "Messages not found for $lang\n" );
-       }
-}
-
-$s = $header .
-       spFormatEntityMessages( $allMessages, 'election' ) .
-       "<question>\n" .
-       "<id>" . ($spConf['baseId'] + 1) . "</id>\n" .
-       "<message name=\"text\" lang=\"en\"></message>\n";
-
-for ( $i = 1; $i <= $spConf['numCandidates']; $i++ ) {
-       $s .=
-               "<option>\n" .
-               "<id>" . ( $i + $spConf['baseId'] + 1 ) . "</id>\n" .
-               spFormatEntityMessages( $allMessages, "option_$i" ) .
-               "</option>\n";
-}
-$s .= "</question>
-</configuration>
-</election>
-</SecurePoll>
-";
-
-echo $s;
-exit( 0 );
-//------------------------------------------------------------------
-
-function spGetMetaTranslations( $lang ) {
-       global $spConf, $wgParser;
-       $messages = array();
-       $titleText = "{$spConf['basePage']}/$lang";
-       $title = Title::newFromText( $titleText );
-       $numMessages = 0;
-       if ( !$title ) {
-               fwrite( STDERR, "Title invalid for lang $lang\n" );
-               return false;
-       }
-       $revision = Revision::newFromTitle( $title );
-       if ( !$revision ) {
-               fwrite( STDERR, "Revision not found for page [[$titleText]]\n" 
);
-               return false;
-       }
-       $text = $revision->getText();
-       if ( $text === false ) {
-               fwrite( STDERR, "Text not found for page [[$titleText]]\n" );
-               return false;
-       }
-
-       for ( $sectionIndex = 1; $sectionIndex <= 10; $sectionIndex++ ) {
-               $section = $wgParser->getSection( $text, $sectionIndex, false );
-               if ( $section === false ) {
-                       break;
-               }
-
-               if ( !preg_match( '/^== *(.*?) *==\s*$/m', $section, $m ) ) {
-                       fwrite( STDERR, "Section header mismatch for section 
$sectionIndex of [[$titleText]]\n" );
-                       continue;
-               }
-               $sectionName = strtolower( $m[1] );
-               $remainder = trim( substr( $section, strlen( $m[0] ) ) );
-               if ( strpos( $remainder, '<nowiki>' ) !== false ) {
-                       fwrite( STDERR, "Message $sectionName for $lang 
contains <nowiki>\n" );
-                       continue;
-               }
-
-               $electionMsgMap = array(
-                       'title' => 'title',
-                       'introduction' => 'intro',
-                       'jump text' => 'jump-text'
-               );
-               if ( isset( $electionMsgMap[$sectionName] ) ) {
-                       $messages['election'][$electionMsgMap[$sectionName]] = 
$remainder;
-                       $numMessages++;
-                       continue;
-               }
-
-               if ( $sectionName == 'candidate text' ) {
-                       $i = 1;
-                       $lines = explode( "\n", $remainder );
-                       foreach ( $lines as $line ) {
-                               if ( preg_match( '/^# *(.*)/', $line, $m ) ) {
-                                       $messages["option_$i"]['text'] = $m[1];
-                                       $numMessages++;
-                                       $i++;
-                               }
-                       }
-                       $i--;
-                       if ( $i !== $spConf['numCandidates'] ) {
-                               fwrite( STDERR, "Not enough candidates for 
$lang: $i/{$spConf['numCandidates']}\n" );
-                               return false;
-                       }
-                       continue;
-               }
-
-               fwrite( STDERR, "Unrecognized section \"$sectionName\" in 
$lang\n" );
-       }
-
-       fwrite( STDERR, "[[$titleText]]: found " . $numMessages . " messages\n" 
);
-       return $messages;
-}
-
-function spFormatEntityMessages( $messages, $entity ) {
-       $s = '';
-       $targetEntity = $entity;
-       foreach ( $messages as $lang => $langMsgs ) {
-               foreach ( $langMsgs as $entity => $entityMsgs ) {
-                       if ( $entity === $targetEntity ) {
-                               foreach ( $entityMsgs as $key => $value ) {
-                                       $s .= Xml::element(
-                                                       'message',
-                                                       array( 'name' => $key, 
'lang' => $lang ),
-                                                       $value
-                                               ) .
-                                               "\n";
-                               }
-                       }
-               }
-       }
-       return $s;
-}
-
diff --git a/cli/wm-scripts/bv2009/populateBv2009EditCount.php 
b/cli/wm-scripts/bv2009/populateBv2009EditCount.php
deleted file mode 100644
index 982ae10..0000000
--- a/cli/wm-scripts/bv2009/populateBv2009EditCount.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-
-/**
- * have made at least 600 edits before 01 June 2009 across Wikimedia wikis 
(edits on several wikis can be combined if your accounts are unified into a 
global account); and
- * have made at least 50 edits between 01 January and 01 July 2009.
- */
-
-require( dirname(__FILE__) . '/../../cli.inc' );
-$dbr = wfGetDB( DB_SLAVE );
-$dbw = wfGetDB( DB_MASTER );
-
-
-$maxUser = $dbr->selectField( 'user', 'MAX(user_id)', false );
-$beforeTime = '20090601000000';
-$betweenTime = array( '20090101000000', '20090701000000' );
-$fname = 'populatebv2009EditCount';
-
-for ( $userId = 1; $userId <= $maxUser; $userId++ ) {
-       $exists = $dbr->selectField( 'user', '1', array( 'user_id' => $userId ) 
);
-       if ( !$exists ) {
-               continue;
-       }
-
-       $longEdits = $dbr->selectField( 'revision', 'COUNT(*)',
-               array(
-                       'rev_user' => $userId,
-                       'rev_timestamp < ' . $dbr->addQuotes( $beforeTime )
-               ), $fname );
-
-       $shortEdits = $dbr->selectField( 'revision', 'COUNT(*)',
-               array(
-                       'rev_user' => $userId,
-                       'rev_timestamp BETWEEN ' . $dbr->addQuotes( 
$betweenTime[0] ) .
-                               ' AND ' . $dbr->addQuotes( $betweenTime[1] )
-               ),
-               $fname
-       );
-
-       if ( $longEdits !== 0 || $shortEdits !== 0 ) {
-               $dbw->insert( 'bv2009_edits',
-                       array(
-                               'bv_user' => $userId,
-                               'bv_long_edits' => $longEdits,
-                               'bv_short_edits' => $shortEdits
-                       ),
-                       $fname
-               );
-               $numUsers++;
-       }
-}
-
-echo wfWikiID() . ": $numUsers users added\n";
-
diff --git a/cli/wm-scripts/bv2009/voterList-bv2009.php 
b/cli/wm-scripts/bv2009/voterList-bv2009.php
deleted file mode 100644
index 42aa018..0000000
--- a/cli/wm-scripts/bv2009/voterList-bv2009.php
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-
-require( dirname( __FILE__ ) . '/../../cli.inc' );
-$dbr = wfGetDB( DB_SLAVE );
-$dbw = wfGetDB( DB_MASTER );
-$fname = 'voterList-bv2009.php';
-$listName = 'board-vote-2009-amended';
-
-if ( !$wgCentralAuthDatabase ) {
-       echo wfWikiID() . ": CentralAuth not active, skipping\n";
-       exit( 0 );
-}
-
-$dbw->delete( 'securepoll_lists', array( 'li_name' => $listName ), $fname );
-
-$userId = 0;
-$numQualified = 0;
-while ( true ) {
-       $res = $dbr->select( 'user', array( 'user_id', 'user_name' ),
-               array( 'user_id > ' . $dbr->addQuotes( $userId ) ),
-               __METHOD__,
-               array( 'LIMIT' => 1000, 'ORDER BY' => 'user_id' ) );
-       if ( !$res->numRows() ) {
-               break;
-       }
-
-       $users = array();
-       foreach ( $res as $row ) {
-               $users[$row->user_id] = $row->user_name;
-               $userId = $row->user_id;
-       }
-       $qualifieds = spGetQualifiedUsers( $users );
-       $insertBatch = array();
-       foreach ( $qualifieds as $id => $name ) {
-               $insertBatch[] = array(
-                       'li_name' => $listName,
-                       'li_member' => $id
-               );
-       }
-       if ( $insertBatch ) {
-               $dbw->insert( 'securepoll_lists', $insertBatch, $fname );
-               $numQualified += count( $insertBatch );
-       }
-}
-echo wfWikiID() . " qualified \t$numQualified\n";
-
-function spGetQualifiedUsers( $users ) {
-       global $wgCentralAuthDatabase, $wgLocalDatabases;
-       $dbc = wfGetDB( DB_SLAVE, array(), $wgCentralAuthDatabase );
-       $editCounts = array();
-
-       # Check local attachment
-       $res = $dbc->select( 'localuser', array( 'lu_name' ),
-               array(
-                       'lu_wiki' => wfWikiID(),
-                       'lu_name' => array_values( $users )
-               ), __METHOD__ );
-
-       $attached = array();
-       foreach ( $res as $row ) {
-               $attached[] = $row->lu_name;
-               $editCounts[$row->lu_name] = array( 0, 0 );
-       }
-       $nonLocalUsers = array();
-
-       $localEditCounts = spGetEditCounts( wfGetDB( DB_SLAVE ), $users );
-       foreach ( $localEditCounts as $user => $counts ) {
-               if ( $counts[0] == 0 ) {
-                       // No recent local edits, remove from consideration
-                       // This is just for efficiency, the user can vote 
somewhere else
-                       $nonLocalUsers[] = $user;
-               }
-               $editCounts[$user] = $counts;
-       }
-       $attached = array_diff( $attached, $nonLocalUsers );
-
-       # Check all global accounts
-       $localWiki = wfWikiID();
-       if ( $attached ) {
-               $res = $dbc->select( 'localuser',
-                       array( 'lu_name', 'lu_wiki' ),
-                       array( 'lu_name' => $attached ),
-                       __METHOD__ );
-               $foreignUsers = array();
-               foreach ( $res as $row ) {
-                       if ( $row->lu_wiki != $localWiki ) {
-                               $foreignUsers[$row->lu_wiki][] = $row->lu_name;
-                       }
-               }
-
-               foreach ( $foreignUsers as $wiki => $wikiUsers ) {
-                       if ( !in_array( $wiki, $wgLocalDatabases ) ) {
-                               continue;
-                       }
-                       $lb = wfGetLB( $wiki );
-                       $db = $lb->getConnection( DB_SLAVE, array(), $wiki );
-                       $foreignEditCounts = spGetEditCounts( $db, $wikiUsers );
-                       $lb->reuseConnection( $db );
-                       foreach ( $foreignEditCounts as $name => $count ) {
-                               $editCounts[$name][0] += $count[0];
-                               $editCounts[$name][1] += $count[1];
-                       }
-               }
-       }
-
-       $idsByUser = array_flip( $users );
-       $qualifiedUsers = array();
-       foreach ( $editCounts as $user => $count ) {
-               if ( spIsQualified( $count[0], $count[1] ) ) {
-                       $id = $idsByUser[$user];
-                       $qualifiedUsers[$id] = $user;
-               }
-       }
-
-       return $qualifiedUsers;
-}
-
-function spGetEditCounts( $db, $userNames ) {
-       $res = $db->select(
-               array( 'user', 'bv2009_edits' ),
-               array( 'user_name', 'bv_long_edits', 'bv_short_edits' ),
-               array( 'bv_user=user_id', 'user_name' => $userNames ),
-               __METHOD__ );
-       $editCounts = array();
-       foreach ( $res as $row ) {
-               $editCounts[$row->user_name] = array( $row->bv_short_edits, 
$row->bv_long_edits );
-       }
-       foreach ( $userNames as $user ) {
-               if ( !isset( $editCounts[$user] ) ) {
-                       $editCounts[$user] = array( 0, 0 );
-               }
-       }
-       return $editCounts;
-}
-
-function spIsQualified( $short, $long ) {
-       return $short >= 50 && $long >= 600;
-}
diff --git a/cli/wm-scripts/elections-2011-spam/buildSpamTranslations.php 
b/cli/wm-scripts/elections-2011-spam/buildSpamTranslations.php
deleted file mode 100644
index cd69bc6..0000000
--- a/cli/wm-scripts/elections-2011-spam/buildSpamTranslations.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-$IP = getenv( 'MW_INSTALL_PATH' );
-if ( $IP === false ) {
-       $IP = dirname( __FILE__ ) . '/../../../../..';
-}
-require_once( "$IP/maintenance/commandLine.inc" );
-
-$wgDebugLogFile = '/dev/stderr';
-
-$dbr = wfGetDB( DB_SLAVE );
-$dbr->debug( true );
-$prefix = "Board_elections/2011/Email/";
-
-$textPrefix = '<div style="{{quote style}}">';
-$textSuffix = "</div>\n[[Category:Board elections 2011]]";
-
-$res = $dbr->select(
-       'page',
-       'page_id',
-       array( 'page_namespace' => 0, 'page_title ' . $dbr->buildLike( $prefix, 
$dbr->anyString() ) ),
-       'boardelection-spam-translation'
-);
-
-foreach( $res as $row ) {
-       $page = Article::newFromID( $row->page_id );
-
-       print "Got article " . $row->page_id . "\n";
-
-       $content = $page->getContent();
-
-       $len = strlen( $textPrefix );
-       if ( substr( $content, 0, $len ) == $textPrefix ) {
-               $content = substr( $content, $len );
-       }
-
-       if ( substr( $content, - $len ) == $textSuffix ) {
-               $content = substr( $content, 0, - $len );
-       }
-
-       $content = trim( $content ) . "\n";
-
-       $lang = substr( $page->getTitle()->getText(), strlen( $prefix ) );
-       $file = dirname( __FILE__ ) . "/email-translations/" . $lang;
-       file_put_contents( $file, $content );
-}
diff --git a/cli/wm-scripts/elections-2011-spam/doSpam.php 
b/cli/wm-scripts/elections-2011-spam/doSpam.php
deleted file mode 100644
index 1f84028..0000000
--- a/cli/wm-scripts/elections-2011-spam/doSpam.php
+++ /dev/null
@@ -1,158 +0,0 @@
-<?php
-
-$IP = getenv( 'MW_INSTALL_PATH' );
-if ( $IP === false ) {
-       $IP = dirname( __FILE__ ) . '/../../../../..';
-}
-require_once( "$IP/maintenance/commandLine.inc" );
-
-ini_set( 'display_errors', 1 );
-
-$err = fopen( 'php://stderr', 'a' );
-
-$nomail = file( '/home/andrew/elections-2011-spam/nomail-list-stripped' );
-$nomail = array_map( 'trim', $nomail );
-
-$wikis = CentralAuthUser::getWikiList();
-#$wikis = array( 'frwiki', 'dewiki', 'commonswiki', 'usabilitywiki' );
-$wgConf->loadFullData();
-
-$users = array();
-
-$specialWikis = array_map( 'trim', file( 
'/home/wikipedia/common/special.dblist' ) );
-
-fwrite( $err, "Loading data from database (pass 1)\n" );
-foreach ( $wikis as $w ) {
-       fwrite( $err, "$w...\n" );
-       list( $site, $siteLang ) = $wgConf->siteFromDB( $w );
-       $tags = array();
-       $pendingChecks = array();
-
-       if ( in_array( $w, $specialWikis ) ) {
-               $tags[] = 'special';
-       }
-
-       $defaultLang = $wgConf->get( 'wgLanguageCode', $w, null, array( 'lang' 
=> $siteLang ), $tags );
-
-       $db = wfGetDB( DB_SLAVE, null, $w );
-
-       try {
-               $res = $db->select(
-                       array( 'securepoll_lists', 'user', 'user_properties' ),
-                       '*',
-                       array( 'li_name' => 'board-vote-2011' ),
-                       __METHOD__,
-                       array(),
-                       array(
-                               'user' => array( 'left join', 
'user_id=li_member' ),
-                               'user_properties' => array( 'left join', array( 
'up_user=li_member', 'up_property' => 'language' ) )
-                       )
-               );
-
-               foreach ( $res as $row ) {
-                       $lang = $row->up_value;
-                       if ( !$lang ) {
-                               $lang = $defaultLang;
-                       }
-                       $mail = $row->user_email;
-                       $name = $row->user_name;
-
-                       if ( !isset( $users[$name] ) ) {
-                               $users[$name] = array();
-                       }
-                       $users[$name][$w] = array( 'name' => $name, 'mail' => 
$mail, 'lang' => $lang,
-                                               'editcount' => 
$row->user_editcount, 'project' => $site,
-                                               'db' => $w, 'id' => 
$row->user_id
-                       );
-                       $pendingChecks[$row->user_id] = $row->user_name;
-               }
-
-               if ( count( $pendingChecks ) > 100 ) {
-                       runChecks( $w, $pendingChecks );
-
-                       $pendingChecks = array();
-               }
-       } catch ( MWException $excep ) {
-               fwrite( $err, "Error in query: ".$excep->getMessage()."\n" );
-       }
-}
-
-fwrite( $err, "Pass 2: Checking for users listed twice.\n" );
-foreach ( $users as $name => $info ) {
-       if ( in_array( $name, $nomail ) ) {
-               fwrite( $err, "Name $name is on the nomail list, ignoring\n" );
-               continue;
-       } elseif ( count( $info ) == 0 ) {
-               fwrite( $err, "User $name has been eliminated due to block or 
bot status\n" );
-               continue;
-       } elseif ( count( $info ) == 1 ) {
-               extract( reset ( $info ) );
-               if ( !$mail ) {
-                       continue;
-               }
-               print "$mail\t$lang\t$project\t$name\n";
-       } else {
-               // Eek, multiple wikis. Grab the best language by looking at 
the wiki with the most edits.
-               $bestEditCount = -1;
-               $bestSite = null;
-               $mail = null;
-               foreach ( $info as $site => $wiki ) {
-                       if ( $bestEditCount < $wiki['editcount'] ) {
-                               $bestEditCount = $wiki['editcount'];
-                               $bestSite = $site;
-
-                               if ( $wiki['mail'] ) {
-                                       $mail = $wiki['mail'];
-                               }
-                       }
-
-                       if ( !$mail && $wiki['mail'] ) {
-                               $mail = $wiki['mail'];
-                       }
-               }
-
-               if ( !$mail ) {
-                       continue;
-               }
-
-               $bestWiki = $info[$bestSite];
-               print "$mail\t{$bestWiki[lang]}\t{$bestWiki[project]}\t$name\n";
-       }
-}
-
-fwrite( $err, "Done.\n" );
-
-/**
- * Checks for ineligibility due to blocks or groups
- *
- * @param $wiki
- * @param $usersToCheck
- */
-function runChecks( $wiki, $usersToCheck /* user ID */ ) {
-       global $users;
-       $dbr = wfGetDB( DB_SLAVE, null, $wiki );
-
-       $res = $dbr->select( 'ipblocks', 'ipb_user',
-               array( 'ipb_user' => array_keys( $usersToCheck ), 'ipb_expiry > 
' . $dbr->addQuotes( $dbr->timestamp( wfTimestampNow() ) ) ),
-               __METHOD__
-       );
-
-       foreach ( $res as $row ) {
-               $userName = $usersToCheck[$row->ipb_user];
-               if ( isset( $users[$userName][$wiki] ) ) {
-                       unset( $users[$userName][$wiki] );
-               }
-       }
-
-       $res = $dbr->select( 'user_groups', 'ug_user',
-               array( 'ug_user' => array_keys( $usersToCheck ), 'ug_group' => 
'bot' ),
-               __METHOD__
-       );
-
-       foreach ( $res as $row ) {
-               $userName = $usersToCheck[$row->ug_user];
-               if ( isset( $users[$userName][$wiki] ) ) {
-                       unset( $users[$userName][$wiki] );
-               }
-       }
-}
diff --git a/cli/wm-scripts/elections-2011-spam/get-voter-list.sh 
b/cli/wm-scripts/elections-2011-spam/get-voter-list.sh
deleted file mode 100755
index c36cd9a..0000000
--- a/cli/wm-scripts/elections-2011-spam/get-voter-list.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-for wiki in `</a/common/all.dblist`; do
-       echo $wiki;
-       echo "SELECT user_email, up_value, '$wiki', user_name FROM 
securepoll_lists JOIN user ON li_member=user_id JOIN user_properties ON 
up_property='language' AND up_user=user_id WHERE li_name='board-vote-2011' AND 
user_email_authenticated IS NOT NULL;" \
-               | sql $wiki | tail -n +2 
>>/home/andrew/elections-2011-spam/users-by-wiki;
-done
diff --git a/cli/wm-scripts/elections-2011-spam/sendMails.php 
b/cli/wm-scripts/elections-2011-spam/sendMails.php
deleted file mode 100644
index f087a9a..0000000
--- a/cli/wm-scripts/elections-2011-spam/sendMails.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-$IP = getenv( 'MW_INSTALL_PATH' );
-if ( $IP === false ) {
-       $IP = dirname( __FILE__ ) . '/../../../../..';
-}
-require_once( "$IP/maintenance/commandLine.inc" );
-
-ini_set( 'display_errors', 1 );
-$err = fopen( 'php://stderr', 'w' );
-$in = fopen( 'php://stdin', 'r' );
-
-$sender = new MailAddress( '[email protected]', 'Wikimedia 
Board Elections Committee' );
-
-// Pull templates
-$langs = explode( ' ', 'bar be-tarask bg bn bs ca cy da de diq el en eo es fa 
fi fr gl he hi hy id ' .
-               'is it ja lb mr ms nb nl pl pt ro ru si sk sq sv tr uk vi yi 
yue zh-hans zh-hant' );
-
-$transTemplates = array();
-
-foreach ( $langs as $lang ) {
-       $transTemplates[$lang] = file_get_contents( 'email-translations/' . 
$lang );
-}
-
-while ( !is_null( $line = fgets( $in ) ) ) {
-       if ( !$line ) {
-               continue;
-       }
-       list( $address, $lang, $site, $name ) = explode( "\t", trim( $line ) );
-
-       if ( !( $name && $lang && $address && $site ) ) {
-               print "invalid line $line $name $lang $address $site\n";
-               continue;
-       }
-
-       $content = $transTemplates[$lang];
-
-       if ( !$content ) {
-               $content = $transTemplates['en'];
-               $lang = 'en';
-       }
-
-       $content = strtr( $content,
-               array(
-                       '$username' => $name,
-                       '$activeproject' => $wgLang->ucfirst( $site ),
-               )
-       );
-
-       $address = new MailAddress( $address, $name );
-
-       $subject = 'Wikimedia Foundation Elections 2009';
-
-       UserMailer::send( $address, $sender, $subject, $content );
-       print "Sent to $name <$address> in $lang\n";
-
-       sleep( 0.1 );
-}

-- 
To view, visit https://gerrit.wikimedia.org/r/73333
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iefc6062fa5062e340378d7825a1dc11186465755
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/SecurePoll
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
Gerrit-Reviewer: Greg Grossmeier <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to