Page MenuHomePhabricator

Cannot use Wikimedia's Mathoid if self-hosted RESTBase is available
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce:

  • Setup RESTbase.
  • Install Math, but without touch additional configuration. The fallback is Wikimedia's Mathoid. ('https://mathoid-beta.wmflabs.org')
  • Go to Special:MathStatus or edit any page with <math> syntax.

What happens?:

An error message is rendered:

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "/mathoid/local/v1/":): {\displaystyle \alpha}

What should have happened instead?:

The render should succeed.

The cause:

If isset( $wgVirtualRestConfig['modules']['restbase'] ), \MediaWiki\Extension\Math\MathRestbaseInterface::getUrl() do not read $wgMathFullRestbaseURL at all because of the early return: https://gerrit.wikimedia.org/g/mediawiki/extensions/Math/+/6868113ae863ad8423c84b6f572cd1bbfdae9723/src/MathRestbaseInterface.php#227

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

  • MediaWiki 1.37

Todos:

  • Add documentation of wgMathPreferRestbaseURL to mediawiki.org
  • backport to REL_1.37, REL_1.38?,

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Does your restbase work (with mathoid). I am not aware that many people are able to set this up except for WMF? I myself did set it up at one point, but it failed after an update and I eventually gave up to repair it since one can use the WMF restbase instance instead.

I manually set up a Parsoid, a RESTBase, and a Mathoid and replaced the 'zero-conf VisualEditor' and using them since 2021.[1] But after filing this task, I've replaced the Mathoid with the Wikimedia Mathoid[2] (for monetary reasons) with a forked extension with hacked code,[3] so I am removing myself as the assignee.

The purpose of this task is just to track the issue. If it is not preferred, I am okay to mark this task as invalid.

1: https://github.com/femiwiki/docker-mediawiki/blob/80acc090/configs/LocalSettings.php#L393-L422
2: https://github.com/femiwiki/docker-mediawiki/commit/4111ed93
3: https://github.com/femiwiki/mediawiki-extensions-Math/compare/REL1_37..REL1_37-fw

@Lens0021 amazing works. I was not aware of femiwiki before.

https://github.com/femiwiki/mediawiki-extensions-Math/compare/REL1_37..REL1_37-fw#diff-023814d3e2258108517d520f053f3ea656553dc0a4186d6f3868f18d44b112eeR228

if you replaced false with wgVisualEditorParsoidAutoConfig and upload the change to Gerrit we can merge that so it will go away in 1_39. Or maybe we find someone who is able to backport the change to 1_37

What do you think?

@Physikerwelt I'm not sure using wgVisualEditorParsoidAutoConfig for that purpose is suitable and/or whether the patch will be accepted. Is what you are saying you can +2?

@Lens0021 you are right, this is probably something else and it is used in production so this would not be a good idea https://github.com/wikimedia/operations-mediawiki-config/blob/c47cd56b0312ca269280f2a433c0eda11cca8b05/wmf-config/CommonSettings.php#L2727
I could +2 a change if it does not affect WMF usage. To be conservative, we could just add another setting, e.g., wgMathPreferRestbaseURL, to redo your behavior.

Change 792123 had a related patch set uploaded (by Lens0021; author: Lens0021):

[mediawiki/extensions/Math@master] Add MathPreferRestbaseURL

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

Change 792123 merged by jenkins-bot:

[mediawiki/extensions/Math@master] Add $wgMathUseInternalRestbasePath

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

Could this change have caused T308546?

I've found the patch includes typo in extension.json, so the answer is maybe yes.

@Physikerwelt Can we revert it? I'm sorry this happend.