Last modified: 2014-08-23 17:32:40 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 52778 - Clean up skin user preferences in user_properties table on Wikimedia wikis
Clean up skin user preferences in user_properties table on Wikimedia wikis
Status: NEW
Product: Wikimedia
Classification: Unclassified
General/Unknown (Other open bugs)
wmf-deployment
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 29782 52777
  Show dependency treegraph
 
Reported: 2013-08-13 04:31 UTC by MZMcBride
Modified: 2014-08-23 17:32 UTC (History)
9 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description MZMcBride 2013-08-13 04:31:39 UTC
This bug tracks the request to write and run a maintenance script on Wikimedia wikis to clean up the skin user preferences. Many skins no longer exist. Many users are storing unneeded values, causing the table to be bloated (cf. bug 52777).

As noted at bug 45179 comment 15, [[Wikipedia:Database reports/User preferences#Skin]] has been messy since it was created. It'd be great to see it cleaned up.

The database report currently looks something like this:

Skin                            Users
MediaWiki:Skinname-             7190151
MediaWiki:Skinname-0            54155
MediaWiki:Skinname-1            1763
MediaWiki:Skinname-2            3075
MediaWiki:Skinname-amethyst     1292
MediaWiki:Skinname-chick        32061
Cologne Blue                    80642
Modern                          69010
MonoBook                        2185224
MediaWiki:Skinname-myskin       16285
Nostalgia                       21256
MediaWiki:Skinname-on           16
MediaWiki:Skinname-simple       14245
MediaWiki:Skinname-standard     34502
Vector                          166182
Comment 1 Sam Reed (reedy) 2013-08-13 04:43:00 UTC
effectively: DELETE FROM user_preferences WHERE up_property = 'skin' AND up_value NOT IN Skin::getSkinNames()

> var_dump( Skin::getSkinNames() );
array(4) {
  ["monobook"]=>
  string(8) "MonoBook"
  ["vector"]=>
  string(6) "Vector"
  ["modern"]=>
  string(6) "Modern"
  ["cologneblue"]=>
  string(11) "CologneBlue"
}


But the up_values need lowercasing to match

Wouldn't take too much to write a script to do something like that...
Comment 2 Matthew Flaschen 2013-08-14 18:27:42 UTC
What about the Skinname- (is this just 'no preference'?), Skinname-0, Skinname-1, and Skinname-2?  Are the numeric ones interpreted as actual skins?  If so, they should be converted over to the names.
Comment 3 Chad H. 2013-08-14 18:40:49 UTC
(In reply to comment #2)
> What about the Skinname- (is this just 'no preference'?), Skinname-0,
> Skinname-1, and Skinname-2?  Are the numeric ones interpreted as actual
> skins? 
> If so, they should be converted over to the names.

Skinname- was possibly "default" a long time ago. Or a database artifact. In any case, it's invalid and these users are currently getting Vector.

Skinname-[0-2] used to refer to specific skins, they do have a 1:1 mapping. The ones that point to skins that are still around can be converted, others are using Vector and can be removed.

I wrote a script that does all of this...someone should just run it across all wikis :)
Comment 4 Oliver Keyes 2013-08-14 18:45:24 UTC
Thank you for volunteering, Chad ;).
Comment 5 Matthew Flaschen 2013-08-14 18:47:14 UTC
(In reply to comment #3)
> I wrote a script that does all of this...someone should just run it across
> all wikis :)

Can you post or link to this?
Comment 6 Chad H. 2013-08-14 20:25:32 UTC
(In reply to comment #4)
> Thank you for volunteering, Chad ;).

Get me a window and I'll be more than happy to.

(In reply to comment #5)
> (In reply to comment #3)
> > I wrote a script that does all of this...someone should just run it across
> > all wikis :)
> 
> Can you post or link to this?

That would be the "cleanupSkinPrefs" script in the WikimediaMaintenance extension. Here you go: https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FWikimediaMaintenance.git/HEAD/cleanupSkinPrefs.php
Comment 7 Sam Reed (reedy) 2013-08-14 20:43:09 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #3)
> > > I wrote a script that does all of this...someone should just run it across
> > > all wikis :)
> > 
> > Can you post or link to this?
> 
> That would be the "cleanupSkinPrefs" script in the WikimediaMaintenance
> extension. Here you go:
> https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FWikimediaMaintenance.
> git/HEAD/cleanupSkinPrefs.php

That's not batched though...
Comment 8 Chad H. 2013-08-14 21:05:32 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > (In reply to comment #3)
> > > > I wrote a script that does all of this...someone should just run it across
> > > > all wikis :)
> > > 
> > > Can you post or link to this?
> > 
> > That would be the "cleanupSkinPrefs" script in the WikimediaMaintenance
> > extension. Here you go:
> > https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FWikimediaMaintenance.
> > git/HEAD/cleanupSkinPrefs.php
> 
> That's not batched though...

Really the only wiki that maybe needs batching is enwiki. The rest have a minuscule number of rows to update.
Comment 9 Sam Reed (reedy) 2013-08-14 22:22:36 UTC
There's the DELETE part too.. Both should be easily updated to use batched queries

Our delete wrapper in it's current form doesn't take options...

Ideally

			do {
				$res = $dbw->delete(
					'user_properties',
					array(
						'up_property' => 'skin',
						'up_value NOT IN (' . $dbw->makeList( $dontChange ) . ')'
					),
					__METHOD__,
					array( 'LIMIT' => 50 )
				);
				wfWaitForSlaves();
			} while ( $res->numRows() === 50 );


but in the current state... Ugh.

			do {
				$res = $dbw->query(
					"DELETE FROM user_properties WHERE up_property='skin' AND up_value NOT IN ({$dbw->makeList( $dontChange )}) LIMIT 50",
					__METHOD__
				);
				wfWaitForSlaves();
			} while ( $res->numRows() === 50 );


Logging a bug for it!
Comment 10 Chad H. 2013-08-14 23:56:25 UTC
(In reply to comment #9)
> There's the DELETE part too.. Both should be easily updated to use batched
> queries
> 
> Our delete wrapper in it's current form doesn't take options...
>

"DELETE ...LIMIT" isn't part of the standard, and it's only supported in MySQL and Sqlite :)
Comment 11 MZMcBride 2013-08-15 00:49:21 UTC
(In reply to comment #6)
> That would be the "cleanupSkinPrefs" script in the WikimediaMaintenance
> extension. Here you go:
> https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FWikimediaMaintenance.git/HEAD/cleanupSkinPrefs.php

Nice to see that there's a script for this (or a start to one). :-)

It's in the wrong place, though. The most natural place to find such a script would be in the maintenance directory of MediaWiki core (this is where I looked after Matt posted his question in comment 6). Other wikis will want to clean out their skin preferences as well, presumably. There's nothing Wikimedia-specific about this, as far as I can tell, so the WikimediaMaintenance extension is simply the wrong place for this script.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links