Anomie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/68654


Change subject: More coding style fixes to elections-2011-spam imports
......................................................................

More coding style fixes to elections-2011-spam imports

Additional whitespace fixes not done in Ide26a0ae.

Change-Id: Ibaef3df23e200860507e6e3b19daf8ce994ae4b1
---
M cli/wm-scripts/bv2013/doSpam.php
M cli/wm-scripts/elections-2011-spam/doSpam.php
M cli/wm-scripts/elections-2011-spam/sendMails.php
3 files changed, 41 insertions(+), 41 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecurePoll 
refs/changes/54/68654/1

diff --git a/cli/wm-scripts/bv2013/doSpam.php b/cli/wm-scripts/bv2013/doSpam.php
index 16e5c3f..3edbbbd 100644
--- a/cli/wm-scripts/bv2013/doSpam.php
+++ b/cli/wm-scripts/bv2013/doSpam.php
@@ -18,7 +18,7 @@
 $specialWikis = array_map( 'trim', file( 
'/home/wikipedia/common/special.dblist' ) );
 
 fwrite( $err, "Loading data from database (pass 1)\n" );
-foreach( $wikis as $w ) {
+foreach ( $wikis as $w ) {
        fwrite( $err, "$w...\n" );
        list( $site, $siteLang ) = $wgConf->siteFromDB( $w );
        $tags = array();
@@ -41,19 +41,19 @@
                        array(),
                        array(
                                'user' => array( 'left join', 
'user_id=li_member' ),
-                               'user_properties' => array( 'left join', 
array('up_user=li_member', 'up_property' => 'language' ) )
+                               'user_properties' => array( 'left join', array( 
'up_user=li_member', 'up_property' => 'language' ) )
                        )
                );
 
-               foreach( $res as $row ) {
+               foreach ( $res as $row ) {
                        $lang = $row->up_value;
-                       if (!$lang) {
+                       if ( !$lang ) {
                                $lang = $defaultLang;
                        }
                        $mail = $row->user_email;
                        $name = $row->user_name;
 
-                       if ( !isset($users[$name]) ) {
+                       if ( !isset( $users[$name] ) ) {
                                $users[$name] = array();
                        }
                        $users[$name][$w] = array( 'name' => $name, 'mail' => 
$mail, 'lang' => $lang,
@@ -63,25 +63,25 @@
                        $pendingChecks[$row->user_id] = $row->user_name;
                }
 
-               if ( count($pendingChecks) > 100 ) {
+               if ( count( $pendingChecks ) > 100 ) {
                        runChecks( $w, $pendingChecks );
 
                        $pendingChecks = array();
                }
-       } catch (MWException $excep) {
-               fwrite($err, "Error in query: ".$excep->getMessage()."\n" );
+       } 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 ) {
+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) {
+       } elseif ( count( $info ) == 1 ) {
                extract( reset ( $info ) );
                if ( !$mail ) {
                        continue;
@@ -92,12 +92,12 @@
                $bestEditCount = -1;
                $bestSite = null;
                $mail = null;
-               foreach( $info as $site => $wiki ) {
-                       if ($bestEditCount < $wiki['editcount']) {
+               foreach ( $info as $site => $wiki ) {
+                       if ( $bestEditCount < $wiki['editcount'] ) {
                                $bestEditCount = $wiki['editcount'];
                                $bestSite = $site;
-                               
-                               if ($wiki['mail']) {
+
+                               if ( $wiki['mail'] ) {
                                        $mail = $wiki['mail'];
                                }
                        }
@@ -116,7 +116,7 @@
        }
 }
 
-fwrite($err, "Done.\n" );
+fwrite( $err, "Done.\n" );
 
 /**
  * Checks for ineligibility due to blocks or groups
@@ -129,11 +129,11 @@
        $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() ) ) ),
+               array( 'ipb_user' => array_keys( $usersToCheck ), 'ipb_expiry > 
' . $dbr->addQuotes( $dbr->timestamp( wfTimestampNow() ) ) ),
                __METHOD__
        );
 
-       foreach( $res as $row ) {
+       foreach ( $res as $row ) {
                $userName = $usersToCheck[$row->ipb_user];
                if ( isset( $users[$userName][$wiki] ) ) {
                        unset( $users[$userName][$wiki] );
@@ -141,11 +141,11 @@
        }
 
        $res = $dbr->select( 'user_groups', 'ug_user',
-               array( 'ug_user' => array_keys($usersToCheck), 'ug_group' => 
'bot' ),
+               array( 'ug_user' => array_keys( $usersToCheck ), 'ug_group' => 
'bot' ),
                __METHOD__
        );
 
-       foreach( $res as $row ) {
+       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/doSpam.php 
b/cli/wm-scripts/elections-2011-spam/doSpam.php
index 16e5c3f..3edbbbd 100644
--- a/cli/wm-scripts/elections-2011-spam/doSpam.php
+++ b/cli/wm-scripts/elections-2011-spam/doSpam.php
@@ -18,7 +18,7 @@
 $specialWikis = array_map( 'trim', file( 
'/home/wikipedia/common/special.dblist' ) );
 
 fwrite( $err, "Loading data from database (pass 1)\n" );
-foreach( $wikis as $w ) {
+foreach ( $wikis as $w ) {
        fwrite( $err, "$w...\n" );
        list( $site, $siteLang ) = $wgConf->siteFromDB( $w );
        $tags = array();
@@ -41,19 +41,19 @@
                        array(),
                        array(
                                'user' => array( 'left join', 
'user_id=li_member' ),
-                               'user_properties' => array( 'left join', 
array('up_user=li_member', 'up_property' => 'language' ) )
+                               'user_properties' => array( 'left join', array( 
'up_user=li_member', 'up_property' => 'language' ) )
                        )
                );
 
-               foreach( $res as $row ) {
+               foreach ( $res as $row ) {
                        $lang = $row->up_value;
-                       if (!$lang) {
+                       if ( !$lang ) {
                                $lang = $defaultLang;
                        }
                        $mail = $row->user_email;
                        $name = $row->user_name;
 
-                       if ( !isset($users[$name]) ) {
+                       if ( !isset( $users[$name] ) ) {
                                $users[$name] = array();
                        }
                        $users[$name][$w] = array( 'name' => $name, 'mail' => 
$mail, 'lang' => $lang,
@@ -63,25 +63,25 @@
                        $pendingChecks[$row->user_id] = $row->user_name;
                }
 
-               if ( count($pendingChecks) > 100 ) {
+               if ( count( $pendingChecks ) > 100 ) {
                        runChecks( $w, $pendingChecks );
 
                        $pendingChecks = array();
                }
-       } catch (MWException $excep) {
-               fwrite($err, "Error in query: ".$excep->getMessage()."\n" );
+       } 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 ) {
+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) {
+       } elseif ( count( $info ) == 1 ) {
                extract( reset ( $info ) );
                if ( !$mail ) {
                        continue;
@@ -92,12 +92,12 @@
                $bestEditCount = -1;
                $bestSite = null;
                $mail = null;
-               foreach( $info as $site => $wiki ) {
-                       if ($bestEditCount < $wiki['editcount']) {
+               foreach ( $info as $site => $wiki ) {
+                       if ( $bestEditCount < $wiki['editcount'] ) {
                                $bestEditCount = $wiki['editcount'];
                                $bestSite = $site;
-                               
-                               if ($wiki['mail']) {
+
+                               if ( $wiki['mail'] ) {
                                        $mail = $wiki['mail'];
                                }
                        }
@@ -116,7 +116,7 @@
        }
 }
 
-fwrite($err, "Done.\n" );
+fwrite( $err, "Done.\n" );
 
 /**
  * Checks for ineligibility due to blocks or groups
@@ -129,11 +129,11 @@
        $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() ) ) ),
+               array( 'ipb_user' => array_keys( $usersToCheck ), 'ipb_expiry > 
' . $dbr->addQuotes( $dbr->timestamp( wfTimestampNow() ) ) ),
                __METHOD__
        );
 
-       foreach( $res as $row ) {
+       foreach ( $res as $row ) {
                $userName = $usersToCheck[$row->ipb_user];
                if ( isset( $users[$userName][$wiki] ) ) {
                        unset( $users[$userName][$wiki] );
@@ -141,11 +141,11 @@
        }
 
        $res = $dbr->select( 'user_groups', 'ug_user',
-               array( 'ug_user' => array_keys($usersToCheck), 'ug_group' => 
'bot' ),
+               array( 'ug_user' => array_keys( $usersToCheck ), 'ug_group' => 
'bot' ),
                __METHOD__
        );
 
-       foreach( $res as $row ) {
+       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/sendMails.php 
b/cli/wm-scripts/elections-2011-spam/sendMails.php
index 98389b4..2adba1b 100644
--- a/cli/wm-scripts/elections-2011-spam/sendMails.php
+++ b/cli/wm-scripts/elections-2011-spam/sendMails.php
@@ -13,7 +13,7 @@
 
 $transTemplates = array();
 
-foreach( $langs as $lang ) {
+foreach ( $langs as $lang ) {
        $transTemplates[$lang] = file_get_contents( 'email-translations/' . 
$lang );
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibaef3df23e200860507e6e3b19daf8ce994ae4b1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SecurePoll
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

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

Reply via email to