Page MenuHomePhabricator

Migrate old Math options to current ones or delete them from the database
Open, LowPublic

Description

The source of the Math extension currently says:

		// The following deprecated modes have been removed:
		// 'MW_MATH_SIMPLE'      => 1
		// 'MW_MATH_HTML'        => 2
		// 'MW_MATH_MODERN'      => 4
		// 'MW_MATH_MATHJAX'     => 6
		// 'MW_MATH_LATEXML_JAX' => 8

		$defs = [
			'MW_MATH_PNG'    => 0,
			'MW_MATH_SOURCE' => 3,
			'MW_MATH_MATHML' => 5,
			'MW_MATH_LATEXML'=> 7 ];

Still, a lot of user accounts have the deprecated options set. Here's English Wikipedia:

mysql:wikiadmin@db1089 [enwiki]> select up_value, count(up_value) from user_properties where up_property = 'math' and up_value not in ( '0', '3', '5', '7', 'png', 'source', 'mathml' ) group by up_value;
+----------+-----------------+
| up_value | count(up_value) |
+----------+-----------------+
|          |             525 |
| 2        |           13315 |
| 4        |           45067 |
| 6        |            5697 |
| on       |              26 |
+----------+-----------------+
5 rows in set (0.75 sec)

As far as I can tell, preferences can be removed from the Math extension entirely (see T166367), but if that is an exaggeration, then perhaps the old values could be migrated to current ones, or simply deleted from the database.

I guess that 4, 6, and 8 could be deleted from the database, because they are very similar to MathML, which is the default. I don't really remember how do 1 and 2 actually look, but I'd bet on simply deleting them as well. The empty values could probably be deleted, too. I'm not sure what does "on" mean at all.

Additionally, the <chem> and <math chem> tags should also respect the user preferences. It should no longer be a problem to create png images for chem and use the same fall-back options that normal math uses.

Event Timeline

Physikerwelt subscribed.

Someone with db access needs to take care of that. It's a simple task to clean old user preferences. Theoretically, one could also load and save all user preferences from time to time (not only for math) and store them again to eliminate invalid values. But why would one care? The math extension assumes the content can be invalid and returns to a default value, so this is not an issue from the Math extension perspective.

We do have a bloat problem in user_properties table: T54777: user_properties table bloat not one single property is problematic but they are adding up. There is a maint script that can drop the property if it's all useless now but this has valid cases I think?

We do have a bloat problem in user_properties table: T54777: user_properties table bloat not one single property is problematic but they are adding up. There is a maint script that can drop the property if it's all useless now but this has valid cases I think?

Then it makes sense to prune non-default options. See https://github.com/wikimedia/operations-mediawiki-config/blob/1c2cb0976f0d7275652fe8821a14e61593773c21/wmf-config/InitialiseSettings.php#L4740-L4747

'wgMathValidModes' => [
	'default' => [ 'source', 'mathml', 'native', 'mathjax' ],
],

'wmgMathDefaultUserOptions' => [
	'default' => 'mathml',
	'group0' => 'native',
],

The default might change in the future however

I dont' think DBAs are needed anymore. Anyone with deployment rights can delete those.