Commit graph

147 commits

Author SHA1 Message Date
Moritz Schubotz (physikerwelt) 92c4db78ef Set up mathoid and mathlatexml regardless of configuration
Set up both database tables (mathoid and mathlatexm) regardless of the enabled modes. This will allow to change configuration without having to rerun db update scripts for the price of having potentially empty tables in the db.

Bug: T307896
Change-Id: I5ed50e53835c378f9f497a6ff3a4195299259d5b
2022-06-01 10:04:10 +00:00
jenkins-bot 9e420ab960 Merge "Use new ResourceLoader namespace" 2022-05-24 23:44:32 +00:00
Tim Starling a5c7506265 Use new ResourceLoader namespace
Extensions using Phan need to be updated simultaneously with core due
to T308443.

Bug: T308718
Depends-On: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
Change-Id: I6d355e7037186e840a76f319886ed870419d9fc8
2022-05-24 22:59:43 +00:00
lens0021 72a537e8a8 Add $wgMathUseInternalRestbasePath
Adds a new configuration variable that can be used to run RESTBase
independently from Math.

Bug: T306572
Change-Id: Ie40bd36a53fa5018364cf9268fee29533f4aa23b
2022-05-17 07:32:57 +00:00
Alexander Vorwerk 1f8553bc3a Replace usage of deprecated global function wfReadOnly()
The global function wfReadOnly() has been deprecated in favor of the
new ReadOnlyMode service. Its usages should be replaced.

Bug: T283978
Change-Id: I8f7c026961a6b65e2e45a675c54f0481ccdf09e0
2021-12-26 00:03:40 +01:00
Umherirrender da9a7bfc17 doc: Cleanup @param documentation
No extra sign needed between variable and description

Change-Id: I870cb71b6304ff1760499541190fd4cd44bf1a87
2021-11-04 22:29:36 +01:00
physikerwelt (Moritz Schubotz) b51408c4aa Remove empty string workaround
Old versions of Math returned

<dl>
<dd>iso-8859-1</dd>
</dl>

for empty math tags. This is no longer the case today.

Moreover, a problem in the png2svg conversion was fixed
in mathoid recently Iaf41f61335b4af51f758b64427c6e661ee36fb1b
This version of mathoid is now used in production.

Therefore, we can remove the handling of the special case.

Bug: T10372
Change-Id: Id835f7041a19f9519e7d5640b69a02b4b8a3397e
2021-10-03 14:42:25 +02:00
Reedy df89742072 Remove global namespace class aliases
Depends-On: I7e8e7f5ec0ac2f995489a559e88fc55ab877e06e
Change-Id: Ie3f5d5880363777eda4608fe8753a69e7ff3c5f9
2021-10-01 16:30:09 +00:00
Petr Pchelko cfc2f4f319 Register 'math' parser option
Instead of modifying a page rendering hash,
use the proper mechanism of parser option
registration. The cache is still split on parser
option value. The 'math' option is lazy, since
not all pages contain 'math' tag and we want to
avoid an user preference lookup for every parse.

WARNING: this will invalidate ParserCache for
all pages that contain <math> tags, but according
to Moritz, this is about 1% of all pages, so we
should be fine.

Setting up the test is still rather hard and weird
due to very hacky rendering mode to user option
converter, and math renderer interaction with the DB.
This will be cleaned up later.

Depends-On: I92b3e18fabef4eecac2ec2a4844f1be2716e5d89
Change-Id: I3bce04684070ad306685dabbc51267def25773cd
2021-09-30 06:55:54 -07:00
Petr Pchelko b458303fed Move rendering modes name resolution to MathConfig
Change-Id: Ie1926f1da02f6ab585d3efbc71abe1716dac66e5
2021-09-30 06:29:36 -07:00
Petr Pchelko a3306b24df Clean up handling of user preferences
Change-Id: I3e8f0a0be16d92a411de796b8e25df3a7760099f
2021-09-29 10:28:03 -07:00
Petr Pchelko 9b7205599c Move math configuration methods into a service
This is doing a bulk of the job of creating a service
for working with math modes configuration. There's
still things to do, like moving math mode names,
and perhaps depending on default user options to
provide a bit more convenience, but that will be the
next step.

Change-Id: I1259a93651920f44104f2f5135e3e620c858be8d
2021-09-28 13:31:08 -07:00
libraryupgrader 1e15355fdf build: Updating composer dependencies
* mediawiki/mediawiki-phan-config: 0.10.6 → 0.11.0
* php-parallel-lint/php-parallel-lint: 1.3.0 → 1.3.1

Change-Id: I6c13f1e5d7488e269b5ca6f26ee4aa7cc22638c1
2021-09-09 11:08:17 +00:00
physikerwelt (Moritz Schubotz) 817a56acc3
Allow rendering of <math>0</math>
Bug: T288846
Change-Id: I5c5cd3e759b245b028c42f19ba6199b8f6f48aaa
2021-08-26 11:27:54 +02:00
Petr Pchelko 2c4d8bbcf7 Support null content in parser tag hook
Bug: T288846
Change-Id: I1f3e8012db83c98f3057b01f1bd563ef327be8d3
2021-08-13 13:06:38 -07:00
Petr Pchelko da8e918fb3 Enable most tests which were previously disabled
Additionally - remove RestbaseInterface::checkBackend.
When HTTP requests are banned from unit tests this method
makes no sence.

MathoidCli tests were not reenabled cause it's a bit hard
to mock shell acceess. Hopefully as part of Shellbox
transition we can have MockShell trait in core and reenable
those tests

Bug: T265628
Depends-On: I350ed59af603a0504704af3265787a4be8f2dc2a
Change-Id: I294d0ed905193850dc38cb3071eb9b31c8863121
2021-08-12 08:57:58 -07:00
Petr Pchelko 0cd6acd3f7 First pass at cleaning up error handling
The overall aim is to make renderer and checker
proper services and stop storing each operation
state in them. This patch reduces the number of
places where we store the lastError. I've decided
to stop here in the first pass so that the patch
doesn't grow out of proportion.

Change-Id: Ice7e1f9f2f074d62ef1819355a510ce0b0335d88
2021-08-11 06:05:33 -07:00
Petr Pchelko 404315973e MathLateXML: override getPostData
Instead of having a separate method for getting the post data
in MathLateXML, we can just override getPostData method from
parent and make the makeRequest method signature much simpler.

Change-Id: I07b683856885396ff7b6b5a40df79399828c8214
2021-08-10 12:12:53 -07:00
Petr Pchelko 44ad3fbdf9 MathMathML::batchEvaluate - only pass MathRenderer
We do not need a ParserObject in the batchEvaluate,
so only pass in the MathRenderer

Change-Id: Id2e8cad709c08a0225597cb1fbf85289830f828b
2021-08-05 07:09:59 +00:00
Petr Pchelko ddff31bb0d Remove deprecated feature to declare multiple mathoid hosts
This is not the job of an extension to be a load balancer.
This feature was already deprecated and is not used in WMF prod.

Change-Id: I950dbaf45bc40d9d9ed61b1c98b339d3d38326fc
2021-08-03 09:21:43 -07:00
Petr Pchelko 45090ad369 Make use of MockHttpTrait instead of custom mechanism
Depends-On: I4c3aab6ab88695729b4f398dacf3575fbdb4dad4
Change-Id: I60b192c9b9c2ae434fb3f9aff8c460e0fc0806b1
2021-08-02 13:46:44 -07:00
Petr Pchelko e6507e95d7 Create Math.RendererFactory service
Change-Id: I474d746bae81ddf4322814c45141c981ecdb077b
2021-08-02 11:57:57 -07:00
Petr Pchelko e9bc5d3a42 Switch parser hooks to a new-style hook handler
Change-Id: Ie09e4cfb31a8aaea6f21d7472ae3a067dcc7c40b
2021-07-31 08:17:29 -07:00
Petr Pchelko ed08441fa3 Remove ParserTestTables hook handler.
This hook is no longer needed by core so it's not
called anymore.

See I5124789fac333a664b73b4b4a1e801ecc0a618ca

Change-Id: I9a554b4e70a2564834e1df4058b1ad5cb98a56e3
2021-07-30 13:00:46 +00:00
vladshapik a024908d5f Avoid using deprecated Parser::getUser
Bug: T287168
Change-Id: If3443b879ee01c3cbdbf94d1a690bd9c3bf182b1
2021-07-27 17:50:25 +03:00
libraryupgrader b409746fc6 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* ws: 7.3.0 → 7.5.3
  * https://npmjs.com/advisories/1748 (CVE-2021-32640)
* glob-parent: 5.1.1 → 5.1.2
  * https://npmjs.com/advisories/1751 (CVE-2020-28469)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)
* normalize-url: 4.5.0 → 4.5.1
  * https://npmjs.com/advisories/1755 (CVE-2021-33502)

Change-Id: Ie14979780cdbd04fa2804f5317e8b0f6b0029470
2021-07-23 02:28:22 +00:00
Lucas Werkmeister 86af4f10cd Use RepoLinker for MathWikibaseConnector::buildURL()
Note that this changes the URL, which is directly shown to the user
(SpecialMathWikibase::buildPageRepresentation() uses it as the link
text). I think that’s okay (though it would probably be nicer to use
only the item ID as the text).

Bug: T286539
Change-Id: I50c49040846a5e08e5a354641fff35598034ceb9
2021-07-13 11:53:32 +02:00
Amir Sarabadani b4fd28f842 Replace class_exists with ExtensionRegistry
And also changing name of the function because it's making phpcs unhappy

Bug: T274275
Change-Id: I8d75fb919f87d2404d61ec756bc1cd27510f6d2a
2021-06-21 13:58:31 +02:00
physikerwelt (Moritz Schubotz) d25dc0fb79 Remove wgMathUseRestBase
Bug: T274436
Change-Id: I0c0311130516646833ef862e047c8f540f40c92a
2021-05-14 14:39:25 +02:00
libraryupgrader c416046515 build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: Iccba9c52c8390b00fe1cc31e5f3bed3074e27f85
2021-05-05 06:48:02 +00:00
rosalie d98a6e2699 Remove WikibaseRepo::getDefaultInstance() calls
Bug: T280984
Change-Id: I9ad722a71c671981cace449b3d61aefe6d627a6f
2021-04-28 18:36:51 +02:00
Umherirrender 1b9edee834 Use ::class for class name
This works also for non-existing classes,
because it is resolved on compile time

Change-Id: I693c716d4c0d865f457b5039d7161ff58e1e3c65
2021-04-08 21:19:33 +02:00
Reedy b0f07ee605 Namespace extension
Change-Id: I7ba90b35e5b6f6e4c296079fc524667ea41c0980
2021-04-08 01:17:14 +01:00
Itamar Givon 385d54f607 Update calls to WikibaseClient::getLanguageFallbackLabelDescriptionLookupFactory
Bug: T279084
Depends-On: Ibcd85906b7317e67175616a00a04333f9ffb7ca6
Change-Id: I18c1c4690dc9ec1a8adbb24268b2bff3f8331b2b
2021-04-07 10:24:31 +02:00
ZabeMath e0ca2b86f4 Avoid using User::setOption()
User::setOption() is deprecated and should be replaced with UserOptionsManager::setOption()

Bug: T277818
Change-Id: I8bfcf9e732b6067d5461792d78c8b41ac31de3a9
2021-04-02 18:31:47 +00:00
Lucas Werkmeister 004da5f9ad Update WikibaseClient::getStore() call
Bug: T277482
Change-Id: I9c1af47257121e0d3346c5aa3d62ce746f47a0d2
Depends-On: I6b80739641d55730d8e0a217d9f23aa9392bdf35
2021-03-31 19:52:21 +02:00
jenkins-bot 646fcf6ad1 Merge "Update WikibaseClient::getSite() call" 2021-03-09 10:57:24 +00:00
jenkins-bot 2652cf4e64 Merge "Update WikibaseClient::getSettings() calls" 2021-03-09 10:57:12 +00:00
Lucas Werkmeister a9d2b684b8 Update WikibaseRepo::getStringNormalizer() call
Bug: T276430
Change-Id: Ibc9dc74650b3e6bd726ae452a744c9b433ccef08
Depends-On: I58a9dc2f9f185f260bd6da84840f2b58905d38fa
2021-03-04 14:37:41 +01:00
Lucas Werkmeister 2afaad505d Update WikibaseClient::getSite() call
Bug: T276349
Change-Id: I37b7876c43a7c21fc14f228f3133ed897742bb4e
Depends-On: I9724724a635b808a7f1a8c88447216dc0d1dd738
2021-03-04 11:37:03 +01:00
Lucas Werkmeister 9247f49067 Update WikibaseClient::getSettings() calls
Bug: T275412
Change-Id: I9d0762886cebb96c0d5de911248a53a9ffc14a0f
Depends-On: I3506ad80d57639f066c2b86358058b4432b6a666
2021-03-04 11:36:55 +01:00
Itamar Givon 6a8f7df8ad Update getEntityIdParser method callers to static
Bug: T275886
Depends-On: I5bcd59b954521b74eeae4f2f207ebb35ccba97d7
Change-Id: I1f930a809a6094e2079b972a78cc3403ddeb6f73
2021-03-01 16:34:14 +01:00
jenkins-bot 7bb3d281da Merge "Use Mathoid to validate Wikibase formuale" 2021-02-23 21:06:52 +00:00
jenkins-bot 92cc03d300 Merge "Remove redundant ExtensionRegistry callback" 2021-02-18 21:51:29 +00:00
Moritz Schubotz (physikerwelt) 35d57a65cc Use Mathoid to validate Wikibase formuale
* Reenable math validator tests
* Introduce $wgMathUseRestBase which defaults to true
  and determines if mathoid is used via RESTbase or directly
* The effect of this change can be tested by setting $wgMathUseRestBase
  to false, and then creating a new statement of a property with type math.
  One should see a connection to mathoid for every new string and one should
  also see the WAN cache for the check endpoint to fill up. Note that
  setting WANObject cache to the database simplifies the investigation
  of the WAN cache content.

Bug: T274436
Change-Id: I40109e9e09464da78bf855646fb800ee87c1ea67
2021-02-18 22:13:58 +01:00
jenkins-bot 132dd74949 Merge "Update a few type hints" 2021-02-18 18:27:16 +00:00
Thiemo Kreuz 56ad7ff334 Update a few type hints
Some random bits I found while working on some other code.

Change-Id: I29be84cb54e05af5030defd99cb1f42f9c6a5b63
2021-02-18 16:20:35 +00:00
Thiemo Kreuz 8632db2dfc Use modern new static syntax instead of get_called_class
Change-Id: I901505912784fa32a694c4c854eee86c42fd9c0c
2021-02-18 16:16:42 +00:00
Timo Tijhof 2308e436ce Remove redundant ExtensionRegistry callback
This additional hook does not seem to be needed.

- wgMathValidModes: All access to this information already uses
  getValidModes() and thus there is no need to write this back
  to the input variable (use outside the extension is not supported
  and it is already not used as cache either).

- wgMathDisableTexFilter: All access already uses getDisableTexFilter()
  Move the last bit of logic there instead.

- wgDefaultUserOptions: Duplicate of this already exists in the
  onGetPreferences hook higher up.

This seems almost too easy, so I suspect someone tried this before
and intentionally didn't finish it because of some non-obvious
issue.

See T189966 for related perf anaysis.

Change-Id: I4d7fdf6fcae3d44a37bf80d9c72fff2b4361f0c9
2021-02-10 23:29:49 +00:00
Moritz Schubotz (physikerwelt) 7780424504 Extend mathoids Checker functionality
* Keep status code and response in memory
* Allow external cache preloading.
  This will be required for the one-stop mathoid batch rendering
* Duplicate functionality from the restBASE interface
** Error rendering
** Validity checks
** getter for validated tex

Depends-On: Ic779e671ada0d0306e0935e578b47c431abd520e
Change-Id: I066975b9ba03f5861f6c92687cba4743044ea82a
2021-02-09 23:36:03 +01:00