Commit graph

2855 commits

Author SHA1 Message Date
Thiemo Kreuz 64c94662f0 Add the first small PHPUnit test for Cite::normalizeKey()
Note this is intentionally testing a private method. As of now, the
code is so heavily entangled, it's not yet possible to test individual
aspects without calling private methods. The plan is to slowly increase
the overall test coverage, and the start restructuring the code as
necessary.

Change-Id: Ib3b01bddaffd0469fb66979c67c8114a5807df6d
2019-11-07 09:23:13 +00:00
Thiemo Kreuz ae8360f84a Move some glue code from Cite to the Cite…Hooks classes
I was particularly suprised by the conditions that checked if
`$parser->extCite !== $this`. This can never happen. Maybe it was
possible in a very old version of this code, but it is not any more.

Change-Id: I049ff4109a747eb9dbf325c24cf20f65753827dd
2019-11-07 09:48:08 +01:00
Thiemo Kreuz 1a371ec6a5 Extract all hook handler functions to small glue classes
As of now, this patch does not touch the existing code. However, the
goal is to remove a lot of the related code from the Cite class. This
will be done in later patches. This here is a separate patch to make
reviewing the later patches much easier.

The existing parser tests should be proof enough this chain of patches
is not changing any behavior.

Change-Id: I27ae972f81071bb4036bd452560768fae409417b
2019-11-07 09:45:32 +01:00
Translation updater bot 16b757b88d Localisation updates from https://translatewiki.net.
Change-Id: I8999b6b407545de2f28394322bb7798e27146632
2019-11-07 09:40:56 +01:00
Thiemo Kreuz f590379a64 Fix incomplete @param PHPDoc
Change-Id: I3b17178737cc42e8519a60a2ae2f7cca6ac6ccb3
2019-11-05 14:19:57 +00:00
jenkins-bot fe596f7eb3 Merge "Consistently name the variable for the content" 2019-11-05 10:21:17 +00:00
WMDE-Fisch e3ef0e3a0d Consistently name the variable for the content
Renaming to $text since this is also already used in the array structure
to store the references and seems more intuitive than $str

Change-Id: I4dbe5d10ddc355b4587d195b50cf078ac01fac55
2019-11-05 10:04:49 +00:00
Translation updater bot 3a1a89c364 Localisation updates from https://translatewiki.net.
Change-Id: Ie7c9f4a14ec0f6a6f1f7d6f71d5530a98f3ff916
2019-11-05 09:45:00 +01:00
jenkins-bot 250f7e9973 Merge "Remove not needed and collapse overly complicated code" 2019-11-04 17:03:08 +00:00
Thiemo Kreuz a4b9302d88 Remove not needed and collapse overly complicated code
Change-Id: Iee4241245280b23ab2aaf452363e7db3e21f5554
2019-11-04 16:04:42 +01:00
Thiemo Kreuz 5397919857 Remove obsolete comments
Change-Id: I66246a4d4978e070d45def38ff5b6300f6057eb3
2019-11-04 16:03:33 +01:00
jenkins-bot 4ae083fe72 Merge "Extract handling of guardedRef inside reference tags" 2019-11-04 12:29:13 +00:00
Translation updater bot 85ce680bcb Localisation updates from https://translatewiki.net.
Change-Id: I6bf381a41aac07931c13cfed633c581141d7941b
2019-11-04 09:29:35 +01:00
jenkins-bot e006e9682c Merge "Elaborate comment on invalid keys" 2019-11-03 10:35:30 +00:00
jenkins-bot 164463c090 Merge "build: Updating mediawiki/mediawiki-phan-config to 0.8.0" 2019-11-01 23:16:29 +00:00
Umherirrender 0f17669424 build: Updating mediawiki/mediawiki-phan-config to 0.8.0
Bug: T235049
Change-Id: I317a48bec0fc1a432e8253b357641379828b39a7
2019-11-01 23:50:43 +01:00
WMDE-Fisch e2a98505d1 Fix PHPdoc for Cite::stack()
The text could be null if we're stacking a re-used reference there.
Also content is a more precise word for what was forwarded here.

Change-Id: Ic78fb4744314c40360a61c21e92462b6eb2ae1ab
2019-11-01 16:26:56 +01:00
WMDE-Fisch 2ddae75d95 Elaborate comment on invalid keys
Change-Id: If8e800d69d4ff01ff6c9471e5324c7184e74c136
2019-11-01 15:43:47 +01:00
WMDE-Fisch 85fe486e6a Extract handling of guardedRef inside reference tags
This is just simply moving the code to make the structure more clear.

Change-Id: I680047237458dcfe539525fbb826602d683facc9
2019-11-01 15:41:00 +01:00
Translation updater bot c5fe31f806 Localisation updates from https://translatewiki.net.
Change-Id: I87a0e2f2a758bcce1ec2d3bd2bfb45e18531a794
2019-10-31 09:27:15 +01:00
Translation updater bot 8305228ecd Localisation updates from https://translatewiki.net.
Change-Id: I1de9b607e7fd9a4656e4fa388461a4946ea89f2d
2019-10-28 16:33:03 +01:00
jenkins-bot 87a2bf4bdb Merge "Move unrelated static code to ApiQueryReferences" 2019-10-25 13:01:12 +00:00
jenkins-bot 96b4903da4 Merge "Stop sampling when Reference Previews is enabled" 2019-10-25 11:06:30 +00:00
Thiemo Kreuz ed8dee9bfe Move unrelated static code to ApiQueryReferences
I tried to avoid unrelated refactorings. The only thing I ended doing
is turning a huge if-else around into a guard-clause.

Main motivation here is:
* Make the huge, almost 2000 line Cite class smaller.
* Turn public code into private implementation details.

Bug: T236260
Change-Id: Ifca28040ae60d021a31aaee65417c7584627a975
2019-10-25 10:26:37 +00:00
jenkins-bot 2012944930 Merge "Move misplaced ParserFirstCallInit hook handler to CiteHooks" 2019-10-25 09:02:17 +00:00
jenkins-bot d67684dfe0 Merge "Make use of PHP7's ?? feature instead of isset()" 2019-10-25 08:52:51 +00:00
jenkins-bot 0ffdb0152e Merge "Streamline Hooks section in extension.json" 2019-10-25 08:52:50 +00:00
Thiemo Kreuz 28dd373d24 Move misplaced ParserFirstCallInit hook handler to CiteHooks
All other hook handlers are in the dedicated CiteHooks class.

Main motivation here is to make the huge Cite class smaller,
especially by removing static code that does not rely on anything
else the class does.

Bug: T236260
Change-Id: If0b3f6c989e44283428cda4b2c4d8d5303385d22
2019-10-25 10:34:35 +02:00
jenkins-bot f62736c58c Merge "Simplify private listToText() implementation" 2019-10-25 08:32:49 +00:00
jenkins-bot 714996d72a Merge "Fix capitalization mismatch in class name" 2019-10-25 08:28:40 +00:00
Thiemo Kreuz a037f76317 Streamline Hooks section in extension.json
Main motivation here is to make the list easier to read. We are not
going to have more than a single hook handler per hook anyway.

Bug: T236260
Change-Id: I72357a89402e6febfa1e99f825a3fd699c5561b7
2019-10-25 10:28:08 +02:00
Thiemo Kreuz ddafb6adee Make use of PHP7's ?? feature instead of isset()
Main motivation here is to make the code shorter and faster to read.

Bug: T236260
Change-Id: Ieddc0fe8a292f8f46e9f011a588946dcd063d53d
2019-10-25 10:19:08 +02:00
Thiemo Kreuz 7f99a1bfe1 Simplify private listToText() implementation
Motivation is to make the code shorter and faster to read, and also
perform better.

Bug: T236260
Change-Id: I9186370a628833c1563eb5fa4f2e062fb27d6ed7
2019-10-25 10:17:05 +02:00
Thiemo Kreuz 5acc1e5a2d Fix capitalization mismatch in class name
Change-Id: Id0f9331aecc8b26f4df78839cd43818c4221a5ff
2019-10-25 10:15:53 +02:00
Thiemo Kreuz b65e1bb238 Make use of ctype_digit() instead of a regex
Relevant edge-cases:
* ctype_digit() only works on strings. Anything else, including
integers, will make it return false.
* The empty string will return false.

Both is identical to what the code did before.

Motivation for this change is to streamline the code, and make it
smaller and faster to read.

Bug: T236260
Change-Id: I2d209347d16f2bde14b345c3f88ec64b081283cb
2019-10-25 10:12:39 +02:00
Adam Wight f6b5615e4b Stop sampling when Reference Previews is enabled
There are so few users with this configuration that we need to stop
sampling in order to get data.  Sampling is still in effect for
"baseline" users with the feature disabled.

We use separate schemas to simplify analytics on the two populations.

Bug: T214493
Change-Id: I16e4ed236e50e1e246ff28ff0dba3e52e4b56caf
2019-10-24 22:23:18 +02:00
jenkins-bot f743aa058e Merge "Explicitly demand MW 1.34+ so that we get PHP7.2+" 2019-10-24 13:15:11 +00:00
jenkins-bot 88266ade91 Merge "Refine some workflow related comments" 2019-10-24 13:07:55 +00:00
James D. Forrester 454827ff33 Explicitly demand MW 1.34+ so that we get PHP7.2+
Change-Id: Ie92d6d014e3a8c73ab0b74c798a99318b203d4f9
2019-10-24 15:01:47 +02:00
WMDE-Fisch 9196ccead7 Refine some workflow related comments
Change-Id: Ib7a6c4cc085d91fe27c96cbfd9c7035465149319
2019-10-24 14:38:46 +02:00
Adam Wight 5e8d48b331 Minimal support for bookreferencing tag
Allows the "refines" attribute when the feature flag is set, but doesn't
render.  This is part of our rollback strategy, so that we aren't left
with invalid wikitext in case of undeployment.

Bug: T236257
Change-Id: I936be0e62dccb46caeb84162d2c5166956fd9916
2019-10-24 12:24:36 +00:00
jenkins-bot 4373cb27af Merge "Feature flag for Book Referencing" 2019-10-24 09:56:39 +00:00
jenkins-bot ffa594c636 Merge "Migrate to extension registration version 2" 2019-10-24 09:56:38 +00:00
Adam Wight 6dc206440d Feature flag for Book Referencing
Bug: T236255
Change-Id: I3848eda89178c53af7eeaf87df4efad0f9987557
2019-10-24 09:37:58 +00:00
jenkins-bot bc7738733c Merge "Use waitForModuleState from Util class" 2019-10-24 09:03:44 +00:00
WMDE-Fisch 2f12ae1de4 Use waitForModuleState from Util class
Change-Id: I661aaa08cd48ab48435208323b50108be418815c
2019-10-24 10:48:32 +02:00
Adam Wight 42279a2328 Migrate to extension registration version 2
New manifest schema version requires some minor changes.

Bug: T236255
Change-Id: I9e9d047917c4118ceef1e5be21029d7838f49094
2019-10-24 10:42:18 +02:00
Translation updater bot 08f1f80802 Localisation updates from https://translatewiki.net.
Change-Id: Ia842aab67c90f4bb055da8d3a3862324fd7aebbe
2019-10-24 10:41:28 +02:00
WMDE-Fisch 0ecbf24548 build: Update dependencies
Change-Id: I6f4cfead297f9e47b6655530d672613369b43b64
2019-10-23 17:36:06 +02:00
Translation updater bot 547b52a872 Localisation updates from https://translatewiki.net.
Change-Id: Ieeb1779556b68eab215c3b885ce3a6256eadfa3e
2019-10-23 09:52:34 +02:00