Demon has uploaded a new change for review.

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


Change subject: Fix some stupid mistakes
......................................................................

Fix some stupid mistakes

- Need '' to ignore default settings
- Silly variable typos
- Don't check for int-style skins in bogus check, it
  causes false counts and is already handled above

Change-Id: I69e34b0fd1e3fb81054dddfa8085701ba3dc1bc7
---
M cleanupSkinPrefs.php
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaMaintenance 
refs/changes/76/53176/1

diff --git a/cleanupSkinPrefs.php b/cleanupSkinPrefs.php
index 3fe5122..039ca3e 100644
--- a/cleanupSkinPrefs.php
+++ b/cleanupSkinPrefs.php
@@ -50,6 +50,8 @@
 
                # Current skins
                $currentSkins = array_keys( Skin::getSkinNames() );
+               # Plus an empty string for "default"
+               $currentSkins[] = '';
 
                $dbr = wfGetDB( DB_SLAVE );
                $dbw = wfGetDB( DB_MASTER );
@@ -59,7 +61,7 @@
                $res = (int)$dbr->selectField( 'user_properties', 'COUNT(*) as 
count',
                        array( 'up_property' => 'skin', 'up_value' => 
array_keys( $cleanupMap ) ), __METHOD__ );
                $this->output( "$res users with old integer-style skin 
preferences\n" );
-               if( !$countOnly && $count > 0 ) {
+               if( !$countOnly && $res > 0 ) {
                        $this->output( "Updating..." );
                        foreach( $cleanupMap as $old => $new ) {
                                $dbw->update( 'user_properties', array( 
'up_value' => $new ),
@@ -70,9 +72,10 @@
                }
 
                $res = (int)$dbr->selectField( 'user_properties', 'COUNT(*) as 
count',
-                       array( 'up_property' => 'skin', 'up_value NOT IN (' . 
$dbr->makeList( $currentSkins ) . ')' ), __METHOD__ );
+                       array( 'up_property' => 'skin', 'up_value NOT IN (' . 
$dbr->makeList( $currentSkins ) . ')' ), __METHOD__ )
+                       - $res;
                $this->output( "$res users with bogus skin properties\n" );
-               if( !$countOnly && $count > 0 ) {
+               if( !$countOnly && $res > 0 ) {
                        $this->output( "Updating..." );
                        $dbw->delete( 'user_properties',
                                array( 'up_property' => 'skin', 'up_value NOT 
IN (' . $dbw->makeList( $currentSkins ) . ')' ), __METHOD__ );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I69e34b0fd1e3fb81054dddfa8085701ba3dc1bc7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaMaintenance
Gerrit-Branch: master
Gerrit-Owner: Demon <[email protected]>

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

Reply via email to