Commit graph

296 commits

Author SHA1 Message Date
thiemowmde 14647fa3b1 Fix Phan warning in TexVC class
Required-For: If0429485941c19eb0e88896cb1ada66a5320bafe
Change-Id: I77f4d552b63b7ed935502e2d45cfa97e5310927c
2022-11-23 11:04:10 +01:00
thiemowmde a5668bd0a7 Replace some confusing array_walk with more trivial foreach
Personally I find them confusing because there is apparently no way
to "stop" an array_walk(), and that's why it constantly needs to
check if it even needs to run. Why not use a syntax we can actually
stop? I find this more readable and it makes the code actually run
faster. On average 50% of the iterations get skipped now.

Change-Id: I47b6d5b8f4ad5c9d0f47b389c638196e734809bb
2022-11-23 09:16:52 +00:00
jenkins-bot e0f6e21ac7 Merge "Remove PNG rendering mode" 2022-11-22 19:07:20 +00:00
Bartosz Dziewoński 9207931f53 Simplify VE data modules using 'packageFiles'
We can now serve the JSON data almost directly (although, curiously,
we need a main file in the module that is JavaScript, not JSON),
and without using global state in the JS code.

Change-Id: I203b3e396b28f4b4ef49c3c0918a4025082308c4
2022-11-22 18:43:04 +01:00
jenkins-bot e3d54827cf Merge "Make use of ?: and ?? shortcut syntax where it makes sense" 2022-11-22 12:19:30 +00:00
thiemowmde 67906845ff Make use of ?: and ?? shortcut syntax where it makes sense
I hope this makes the code more readable.

Change-Id: Ie458551d26cd8c8cd6e1cc18789d93176230f0d4
2022-11-22 12:29:44 +01:00
Stegmujo 1b241d4aeb Change validate in MathValidator to php-based checking
Bug: T323554
Change-Id: I8e900e03794bf4eda0ff27381c2c8078234a0b2d
2022-11-22 11:17:20 +00:00
Moritz Schubotz (physikerwelt) 110656335f Remove PNG rendering mode
Removes functionality to
* select PNG rendering mode
* automated fallback to PNG images for SVG rendering
* PNG mode related class and tests

However, PNG images received from mathoid / restbase are still stored.

Bug: T311620
Change-Id: I595926027433182cc0396570bc3f1ce0cd2cafb3
2022-11-21 18:57:27 +00:00
Stegmujo db40ad2ac3 Add Service Initialization in Render
Bug: T312528

Change-Id: I88db7691cf7ac0a66d130b5472b41355a6c4abc2
2022-11-21 11:40:43 +00:00
jenkins-bot 4b6137bed4 Merge "Avoid try…catch where if…else will do when using LanguageFactory" 2022-11-21 08:57:13 +00:00
Bartosz Dziewoński 1b7a46ff4f Avoid try…catch where if…else will do when using LanguageFactory
Needed for I869af06896b9757af18488b916211c5a41a8c563, where I am
trying to change LanguageFactory in MediaWiki core not to use
MWException.

I truly feel mocked after working with this code. See if you can find
the two lines in this diff where the meaningful changes are.

Change-Id: Ifcb31dbb7113ce57526f06558cde2abedee317d7
2022-11-18 21:08:24 +01:00
d.savuljesku ef32effe35 Fix calling array function on stdClass
Bug: T322634
Change-Id: I8c7c7004128da9de6f266ebca43b9aa78802a2de
2022-11-08 14:59:03 +01:00
jenkins-bot 3dcdbbd95b Merge "Fix Perfomance Issues of TexUtil" 2022-10-25 18:10:09 +00:00
jenkins-bot ded8f70772 Merge "Activate chem and inline-tex type input in LocalChecker" 2022-10-25 17:50:31 +00:00
Stegmujo b5d3bca4b4 Fix Perfomance Issues of TexUtil
TexUtil gets instanciated and loads a json for each node in Literal and Fun1. This is not necessary since it takes much RAM and time to load the corresponding JSON from files.

Bug: T321599

Change-Id: I91855ebc4437f075302ae13d367ca4902cc0f3ba
2022-10-25 17:44:02 +00:00
Stegmujo c74ced3716
Activate chem and inline-tex type input in LocalChecker
Bug: T321262

Change-Id: Ib8e55290cc77cdc07274e7f1dbd27d20db0f3227
2022-10-25 18:35:54 +02:00
Stegmujo 2d56f19e3c Fixing Parser for All Wiki and Chem Tests
This is required to run these tests.

Change-Id: I9e12b2f4cf6dc7d96cd51f408d8aa8d71b224ab3
2022-10-25 12:06:58 +00:00
Stegmujo c27f7edef9 Add Integration for the TexVC-PHP check to Math
Bug: T312528

Change-Id: I0eda7d4213a5f703ab7ae7887aa364af9e576dbe
2022-10-20 16:39:19 +00:00
Stegmujo ba47c32e1d
Add Node and Util fixes for Parser.php
For development history of this changeset see:
Id96a4b1b55e3959aab81f4ba436c5ac125f2a1bb

Bug: T312528

Change-Id: I61cfdbd63f8d50b072ada05927a134686fdd53d3
2022-10-19 16:33:15 +02:00
Stegmujo e091c77593 Add TexVC with Check functionality
Bug: T312528

Change-Id: Ib66a4603e3c1869d5c197b72b46b098d0df15e34
2022-10-18 17:57:19 +00:00
Stegmujo ad701733ec Add Grammar and Parser Functionalities
For development history of this changeset see:
Id96a4b1b55e3959aab81f4ba436c5ac125f2a1bb

Bug: T312528

Change-Id: I0e64a3fc4b4556bc4ea6271bd6b778ed2930ab1a
2022-10-18 14:16:45 +00:00
libraryupgrader 049deca5d7 build: Updating mediawiki/mediawiki-phan-config to 0.12.0
Change-Id: I8b7a32686e4ead725539c449a58d58c86e58783c
2022-10-09 12:08:11 +00:00
Stegmujo 2ae8f50348
Add final nodes
Related code:
fb56991251/lib/nodes/

Bug: T312528
Change-Id: I01b99430d510c0df452d1faba340e2595ae50a33
2022-09-06 14:42:37 +02:00
Stegmujo d940161a3e
Add further nodes
Related code:
fb56991251/lib/nodes/

Bug: T312528
Change-Id: I8bd30bc45d2c23214b317ca0c04aa8e7d6a2da33
2022-09-02 19:34:07 +02:00
jenkins-bot 1f4eedf891 Merge "Change type hints for TexNode" 2022-08-27 15:06:29 +00:00
Moritz Schubotz (physikerwelt) db942c2325
Replace 3 backslashes with 4
3 backslashes work as well according to

https://stackoverflow.com/a/28063081

However, it might be confusing as the behaviour would change in double qouted strings. Also mw-core seems to mostly use 4 backslashes.

https: //codesearch.wmcloud.org/core/?q=%5B%5E%5C%5C%5D%5C%5C%5C%5C%5C%5C%5B%5E%5C%5C%5D&i=nope&files=.php%24&excludeFiles=&repos=
Change-Id: I9be37c386f8ca0f9d0a7be641484654cf9a2f7fa
2022-08-27 09:13:08 +02:00
Moritz Schubotz (physikerwelt) 971b7954fe Change type hints for TexNode
Bug: T315978
Change-Id: I06004360a6538f974733021c1f06d8a5bb1f1f7b
2022-08-27 06:55:39 +00:00
Stegmujo 6be5724740 Add some basic nodes and texUtil
Texutil related functionalities and tests will come in other changeset.
Related code:
fb56991251/lib/nodes/

Bug: T312528
Change-Id: Iead338a31403348603442b43ae802270f6b1d675
2022-08-26 15:41:38 +00:00
Stegmujo 4901388cfc
Add TexNode
This is corresponding to 6c6988c4f6/lib/nodes/texnode.js

Bug: T312528
Change-Id: Idfd6826e6d15c0e70848e879dd23fc5e4cf113b5
2022-08-23 08:43:01 +02:00
Reedy b05db18e25 MathRenderer: Check output of parse_url()
Bug: T311674
Change-Id: I437c2d91d6923485da4432f32390a54c1d3abadf
2022-08-07 22:18:45 +01:00
AndreG-P 951dec1fab
REST API endpoint for popups
Implement a rest API endpoint that displays the popup that is currently
only shown on a special page.

Code was revived from Idd22057a88312bf1a1cb5546d0a6edca5678d80d

Bug: T288076
Bug: T233099
Change-Id: I65fcbf25ac5818f6c649daf494c719921247e8f5
2022-08-05 17:47:44 +09:00
AndreG-P 14c4df1336
Support new properties 'Symbol Represents' and 'In Defining Formula'
Add support for the new properties 'P9758' (symbol represents) and
'P2534' (in defining formula) for the special page that shows
in depth information about tagged formulae.

Bug: T312893
Change-Id: I39551e04487f77cca60c89e8c95293032fd5bd6a
2022-07-27 22:30:54 +09:00
Moritz Schubotz (physikerwelt) 480d241f97
Make dependency to Wikibase client config optional
The MathEntitySelector gets its config from wbRepo which caused a hard
dependency on the Wikibase client.
If the Wikibase client config is not available a default value (wikidata)
is used to determine the URL of the foreign repo.
As the dropdown will never do write operations, we restrict the repo
access to anonymous read only.

Bug: T313143
Change-Id: Iba33dfd32a78f4ad7c2e99a1f56218458ab884b4
2022-07-25 09:51:47 +02:00
jenkins-bot 12ca486684 Merge "Replace MathWikibaseConfig with ServiceOptions" 2022-07-25 07:10:18 +00:00
jenkins-bot 53a2ea9909 Merge "Provide static Factory Class for Math related services" 2022-07-25 05:52:32 +00:00
Moritz Schubotz (physikerwelt) 882c49599b
Replace MathWikibaseConfig with ServiceOptions
MathWikibaseConfig introduced additional complexity by passing through
some services to MathWikibaseConnector.
The remaining options were just a list of properties that could also be defined as ServiceOptions.

Bug: T313646
Change-Id: Ib9083c0cb62f6d972befc7f5dc3ed47f55cf92a5
2022-07-23 11:37:30 +02:00
Moritz Schubotz (physikerwelt) 73c41b4626
Provide static Factory Class for Math related services
Initially we provide one service. More services will come in
the future.

Change-Id: I98a0f5f181f729e123a063dabf3597b5effa55b8
2022-07-22 18:59:11 +02:00
Moritz Schubotz (physikerwelt) 0bec9dc904 Remove deprecated method hasSite
The method always returns true and has no obvious benefit.

Change-Id: I77727d37c16e6234cf13e0ccf5d8fe94142ddd2a
2022-07-22 12:51:21 +00:00
Moritz Schubotz (physikerwelt) a274beae78
Transform MathWikibaseConfig into a service
* add some basic tests
* migrate MathWikibaseConnectorTest to a unit test

Bug: T313331
Depends-On: Ic3b8d4f685d5cf648a02696284b6ee499502a12a
Change-Id: I38d6425eb5e2c52ae4362c4b8656223a8d9d90a5
2022-07-21 15:22:47 +02:00
Moritz Schubotz (physikerwelt) a8052d564b
Transform MathWikibaseConnector into a service
* add some basic tests
* MathWikibaseConfig should also be transformed into a service in a follow
up to allow for better testing

Bug: T313331
Change-Id: Iec7446a06d9a117cdeba9d26616f4fdf8e8540ca
2022-07-21 08:34:25 +02:00
Lucas Werkmeister 4022150d1d Use FallbackLabelDescriptionLookupFactory in MathWikibaseConfig
Lookups returned by this factory will resolve redirects; the old factory
is deprecated and will soon be removed.

Bug: T312223
Change-Id: I3d03e2e7ad646c1048f914915b84836f958b7f6e
2022-07-13 18:34:06 +02:00
jenkins-bot 3d493fed35 Merge "Remove some unused methods." 2022-06-27 19:11:49 +00:00
Stegmujo c60565c790 Remove some unused methods.
Bug: T310350
Change-Id: I0629b9a963bf57b1368ffc61f7c3b631b19f5260
2022-06-27 18:20:06 +00:00
jenkins-bot 669d53a714 Merge "schema: Move all sql files to sql folder" 2022-06-23 21:53:57 +00:00
jenkins-bot 3fc4933886 Merge "Bump minimum required version for upgrade to 1.31" 2022-06-23 21:53:56 +00:00
DannyS712 8328544d9c Start catch blocks on the same line as the preceding }
Change-Id: Ib3761884bc2ec14640f6e649ca7a704c9cea83ca
2022-06-23 00:24:02 +00:00
Umherirrender 44f7c7821a schema: Move all sql files to sql folder
It is good practice to have a folder in the root for all sql files.
Also use the engine folder to store the patches

Change-Id: Ic26c042f0a5a8ca6e0568b38c4b4b2b4f0686efb
2022-06-22 18:11:51 +00:00
Umherirrender 1290d24523 Bump minimum required version for upgrade to 1.31
Remove sql patches, mention the gerrit change to check version
- mathlatexml.mathml-length-adjustment.mysql.sql -
Id09ec6201f68efe63a439f6e85a53876d5c1e521

Change-Id: I2d66ab3203758dbe3d0c442163f010595fea5437
2022-06-22 18:09:53 +00:00
Petr Pchelko a245040c20 Remove special handling of math in sections
Originally this was added in T103269, but according
to T103269#6769990 this could not be needed anymore.
I've tested this with the original test case, and it
all works correctly without running the regex.

Change-Id: I5b3b11e71f0d6e55f158fa0d941977c823d12d51
2022-06-10 15:26:43 +00:00
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
Moritz Schubotz (physikerwelt) 67720e080d Improve debugging
* simplify generation of debug output
* invert if statement to reduce indention
* minor fixes:
** update storedInDatabase
** store PNG output
** restore matoid style handling from
   Ief1b6345c17db41f92684e00233d57240e97599f

Bug: T252389
Change-Id: I71853124e5f2633f94fc9aacdedc24a86f27d08b
2021-02-05 18:08:29 +01:00
Vedmaka d110f7eeef
Fixes tags data being lost after first onParserAfterTidy call
This patch is a result of an observation that when <math> tags being
placed before {{#tree:..}} call they are not rendering correctly and
displaying -postMath strip markers instead, so never being replaced by
the actual math markup.

The reason is that the TreeAndMenu do parse operations within its parser
function callback and considering the MathHooks::onParserAfterTidy is
programmed to clear all the MathHooks::$tags data after first call of
the hook it looses all the data stored.

This issue also should appear of <math> is used with any other extension
function that calls parser `parse`, `recursiveTagParse`, etc

The patch modified MathHooks::onParserAfterTidy callback making it
remove tag data only after successful replacement instead of clearing
all the tags data on the first call

Change-Id: Icd115c61492d2ee9aa2004ad1940ff837bd1059a
2021-01-15 11:11:28 +03:00
jenkins-bot 51a51bccb0 Merge "Implement wikidata entity selector" 2020-12-20 19:22:33 +00:00
Umherirrender 9f4f4301cc Avoid wfMessage in special page
Use self::msg instead to avoid global state

Change-Id: I9a9af6ff854fdd94929d06ea270c044320f62cab
2020-12-19 20:19:59 +00:00
Moritz Schubotz (physikerwelt) ba19b3e1cd Implement wikidata entity selector
The current wikidata entity selector requires WikibaseRepo to be enabled on the client wiki, which is only the case for very small installations.

We implement our custom entity selector that
* displays the item label and
* uses the description as tool-tip.

The implementation was inspired by
mw.widgets.TitleInputWidget.

Bug: T229939
Change-Id: I35d6cc317cf2984d9de6e062f79030f5c31c0811
2020-12-19 09:11:40 +01:00
Umherirrender 99c3e91fb4 Add missing @var and improve documentation
Change-Id: I8be91329f1f85f3bf40ea19d3b7e0be7dc655df1
2020-12-17 21:53:28 +01:00
Moritz Schubotz (physikerwelt) 31aa824cc9 Remove RESTbase check compatibility endpoint
Change-Id: I8c539e96519e0f23ed606403ed88370edde70764
2020-11-24 19:24:41 +01:00
libraryupgrader da3c9edb26 build: Updating mediawiki/mediawiki-phan-config to 0.10.4
Change-Id: I0476384b99c41102ddca5928fbb068c45c139d56
2020-11-20 12:50:55 +00:00
Umherirrender dc007663b2 Usage of Yoda conditions is not allowed; switch the expression order
Change-Id: I3e3ca5e380521b514062953d4aeb635793819e89
2020-11-19 22:34:09 +01:00
libraryupgrader ce88944fe5 build: Updating mediawiki/mediawiki-codesniffer to 33.0.0
The following sniffs are failing and were disabled:
* Generic.ControlStructures.DisallowYodaConditions.Found
* MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected
* MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage
* MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage

Additional changes:
* Dropped .inc files from .phpcs.xml (T200956).

Change-Id: I2a0a579219607d60c1557d4b700cdf810f07f538
2020-11-04 04:01:14 +00:00
jenkins-bot a1e4882543 Merge "Register refresh links hook" 2020-10-27 22:43:19 +00:00
Thiemo Kreuz 3bbf35531b Remove confusing doc from MathRestbaseInterface
Change-Id: I5220cd1f0af95e26308aaec5c976d16ec67cb70b
2020-10-05 10:35:07 +02:00
Moritz Schubotz (physikerwelt) 6f41c0887c Register refresh links hook
* register hook
 MathHooks::onMaintenanceRefreshLinksInit
 from MaintenanceRefreshLinksInit

Bug: T248551
Change-Id: I0607265df22da5ab26cfc4c8958e9502b0e31b12
2020-09-29 18:06:08 +02:00
DannyS712 3f16b9f1c2 Remove use of $wgUser in onMaintenanceRefreshLinksInit
For now, the hook handler isn't actually used (T248551) but
when it is at some point it shouldn't use $wgUser

Bug: T248550
Bug: T248551
Change-Id: I826e91411deb91bbd8c58147b32fda3f3e7ed6a8
2020-09-27 01:02:47 +00:00
DannyS712 caa51dc4c9 Remove fallback to $wgUser in MathHooks::onPageRenderingHash
$user is always set

Bug: T248550
Change-Id: Id5a0d271ae840dd2aee4f40b4b7e73ab24f7cf98
2020-09-21 21:22:22 +00:00
MarcoAurelio be3a3f427f i18n: Fix typo 'occured'
Bug: T201491
Change-Id: Idcaa4c1b42f62e2f001a336b4a1fbc7cba46b47f
2020-09-10 18:08:54 +01:00
Lucas Werkmeister 8e0655eb55 Update for namespace moves
Change-Id: Ib22c0d6fae533c1adc63bc0954292c8349e97de0
Depends-On: I2d94d99da811581e76830ae3533c836b22d990c2
2020-06-11 16:43:44 +02:00
Umherirrender 8ee257c4e9 Pass function name to HttpRequestFactory::create
Useful for logging
Replace deprecated MWHttpRequest::factory with service (since 1.32)

Change-Id: I1d952ee807970ab4ffb18db94314c4aa6a7a3ce4
2020-06-07 12:22:10 +02:00
Reedy 2c220ddabc Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: I816b6d26471527137cbddd313cd432f0a37db891
2020-06-05 00:17:18 +00:00
Moritz Schubotz (physikerwelt) 7c41bc19f8 Add mathoid check endpoint to REST API
Expose the math checking service via the REST API.

Port the behaviour of the RESTbase check endpoint to a new endpoint
that uses the MediaWiki API.

* this endpoint does not (yet) provide actual rendering (only checking)
* consequently it does not supply the x-resource-location header

Bug: T252390
Change-Id: I28bcb9a925953062b43cd3481536784431edcd8a
2020-06-01 12:11:24 -07:00
jenkins-bot b07aefbd36 Merge "Parse messages in string context" 2020-05-28 16:52:16 +00:00
jenkins-bot 13453d7831 Merge "Add MathCheckerFactory Service" 2020-05-27 18:44:03 +00:00
Moritz Schubotz (physikerwelt) 707ad58598 Add MathCheckerFactory Service
Use WANObjectCache rather than genuine DB tables for greater
flexibility.

Note, this commit is the second step of Ifd89e2d9cb30fa15cc318f077b434207ed6b7214

Bug: T252390
Change-Id: Ifa7d943875f05088ef697a5a18ad292342a9b4ad
2020-05-27 07:29:49 +02:00
Umherirrender b0f6c21b8e Parse messages in string context
The current default for Message::__toString() is to parse, so this
keeps that behaviour unchanged.

Change-Id: Icf83608b031390126b5e8d29a5600d37589cf411
2020-05-24 17:11:57 +02:00
Tim Starling 7dff64f214 Use HttpRequestFactory::createMultiClient()
This allows it to respect the proposed limit on HTTP request timeout.

Bug: T245170
Depends-On: I8252f6c854b98059f4916d5460ea71cf4b580149
Change-Id: I1c3d96720709253ad15bb8528cdd132571de2e4e
2020-05-21 14:38:48 +10:00
Moritz Schubotz (physikerwelt) fc0faf18c3 Move checking code to a new namespace
Introduce new namespace \MediaWiki\Extension\Math\ and move checking
code to this new namespace.

Note, this commit is the first step of Ifd89e2d9cb30fa15cc318f077b434207ed6b7214

Bug: T252390, T187154
Change-Id: I8c93f4b21d4a72ef2d52d4774d69e4ef55d037ec
2020-05-12 21:26:45 +02:00
DannyS712 17b2ce0d2d Properly restrict SpecialMathStatus to those with purge rights
Bug: T252362
Change-Id: I98eabfbeda2fbef3c317c7bb6aaddf5595788f5c
2020-05-11 05:17:11 +00:00
Moritz Schubotz (physikerwelt) b2359d08a1 Suppress warning if mathoid-cli does not return PNG image
* Currently PHP issues a unspecific warning if mathoid-cli does not
return a PNG image.
* This change suppresses this warning.

Bug: T200493
Change-Id: Ice7d12ca9131d76fe233fd332e37484feaf79883
2020-05-01 19:49:25 +02:00
Moritz Schubotz (physikerwelt) 9dad688f44 Add tracking category for pages that use a deprecated LaTeX syntax
Discussions in the Wikimedia Math Community show that there is consensus
to deprecate the use of MediaWiki specific LaTeX macros that conflict
with LaTeX macros from commonly used packages.
In this change, we show the deprecation warnings generated by mathoid.

Bug: T197842
Change-Id: I24dbb446665fdc227d0e7342fdbf8829b4c1bda4
2020-03-30 21:56:58 +02:00
Thiemo Kreuz a429c8cc35 Fix escaping issues and a series of unrelated code cleanups
Actual changes:
* Let the special page accept the subpage parameter, e.g.
  [[Special:MathWikibase/Q6203]].
* Fix some of the message escaping issues in SpecialMathWikibase.
  Messages that are just plain text and not supposed to contain any
  parameters, wikitext, HTML, or something like this should be
  properly escaped, either via Html::rawElement( $msg->escaped() ) or
  better Html::element( $msg->plain ). The later approach is cheaper.

Other code cleanups that don't affect production:
* Reduce the amount of duplicate code in SpecialMathWikibase.
* Make use of the preg_match() return value.
* Remove default parameters from parent::__construct() call.
* Remove some auto-generated comments.
* Remove some comments that don't add new information, but just repeat
  what the code already says.
* Make use of PHPUnit's assertCount().

We can split this patch into smaller patches, if you prefer. This
should especially be done if one of the changes is controversial, to
not block the other changes. Please tell me.

Change-Id: I8c20014435af3d2ac9c7381fe5fd00b9fe49b2c2
2020-03-21 14:53:15 +00:00
DannyS712 f5d0db1707 Use lowercase for primitive type 'string'
Change-Id: I17b5256ee73d68f3b57801512abac05a5c0d0c03
2020-03-20 15:34:55 +00:00
Timo Tijhof f59757a338 Replace $wgContLanguageCode with $wgLanguageCode
$wgContLanguageCode has been an unconfigurable copy of $wgLanguageCode
since 2006 (MW 1.8).

Bug: T247674
Change-Id: I1d2ec1e63320086fdf9ab7c6321f949c99c1ab2a
2020-03-14 19:31:26 +00:00
Reedy 7345e85b26 Remove trailing : from log error messages
Change-Id: Ie11662d0e55f553917df7a869de4b8019a827ae8
2020-02-14 21:13:07 +00:00
Reedy 819881ad9c Stop using 'url' param when logging
Bug: T245306
Change-Id: I3ba196e01afe172a99d15abf654a630a3f3d219f
2020-02-14 21:13:00 +00:00
Reedy c3a2b12077 Fix some excessive indenting
Change-Id: Icbd2f1461cbff96ad984b23738fb056a6c25af23
2020-02-14 20:57:23 +00:00
Reedy d819311602 Add $snakNamespace parameter to ValueSnakRdfBuilder implementer
Bug: T243122
Change-Id: I9b7c3b9daa81069a5b5eb66271f2c732cefe313f
2020-01-18 14:06:43 +00:00
libraryupgrader 5018e51b29 build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate

Change-Id: I57bb0f5bc4167ea4b4a50d666ad95c02fcc7d8c9
2020-01-14 22:01:54 +00:00
jenkins-bot 6f347e7b34 Merge "build: Updating mediawiki/mediawiki-phan-config to 0.9.0" 2020-01-11 00:39:01 +00:00
jenkins-bot 45e6751a3c Merge "Don't list Special:MathWikibase if the wikibase client isn't loaded" 2019-12-30 09:05:52 +00:00
libraryupgrader 863794c1dd build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Change-Id: Id4f976b7ec94e1d2be0421725733804f24dec2c5
2019-12-29 17:56:56 +00:00
DannyS712 cf906ea1bc Replace @return true|false with @return bool
Change-Id: If6111abcb2c17622e58189a8b7200fc9a49c7b84
2019-12-28 10:29:18 +00:00
DannyS712 8faab2c2a0 Don't list Special:MathWikibase if the wikibase client isn't loaded
Bug: T241507
Change-Id: I23f6e8e72afeb791b3709d423041c02b58eb0b4a
2019-12-28 09:06:47 +00:00
AndreG-P 4c56817ba3 Delete Math Wikibase API
Delete the unused wikibase API endpoint in Math extension.

Bug: T240458
Change-Id: I3e6b0cfd61e8be8c65e64f85945bca32a4ba6089
2019-12-13 00:23:53 +09:00
AndreG-P 157dff4422 Fix reverse logic in hasSite function Math extension
Fixes naming problem introduced in If7da0990a4fc1f8d8a70237dc19c7b2e67ec38cd

Change-Id: I2fd20b2e18c624d22a780dfd496afb129b1f55b9
2019-11-28 19:25:31 +09:00
jenkins-bot 3bb6faf6b0 Merge "Link Wikipedia Articles from Specialpage Math Formula Information" 2019-11-26 19:48:39 +00:00
AndreG-P 912866b976 Link Wikipedia Articles from Specialpage Math Formula Information
Linking math formula on the special page to their own page, if this
a page exists

Bug: T239099
Change-Id: If7da0990a4fc1f8d8a70237dc19c7b2e67ec38cd
2019-11-27 03:58:28 +09:00
Ammar Abdulhamid 4a207bb74a Declare $logger as a protected class variable
Bug: T186243
Change-Id: I263a711fc12993c6201ca71cd512be1f64c1eb38
2019-11-26 17:14:48 +00:00
Ammar Abdulhamid 457ea5822f Classes: Type hint $updater parameter in onLoadExtensionSchemaUpdates
Bug: T223939
Change-Id: Ibc0d87f8cd7cb6a6b0f72c8b5fd08da13b55483f
2019-11-25 16:34:40 +00:00
jenkins-bot 13053e0a9c Merge "Fix capitalization of HTML Class" 2019-11-15 22:33:46 +00:00
Moritz Schubotz (physikerwelt) 848168c3a1
Fix capitalization of HTML Class
* Replace HTML->Html

Introduced in Idd22057a88312bf1a1cb5546d0a6edca5678d80d

Change-Id: If44743507d6897fa7600a16fc2002443cc3a556e
2019-11-15 23:03:48 +01:00
AndreG-P 54518a4981 Delete Wikibase repository dependency in Math extension
With this commit, the Math extension only depends on WikibaseClient
and no longer on WikibaseRepo.

Bug: T208758
Change-Id: Iac8f2568e0da1a4aff4f4b22d124626c8ecca8eb
2019-11-16 01:30:12 +09:00