Commit graph

25 commits

Author SHA1 Message Date
thiemowmde 5ced07c366 Improve a few PHPDoc type hints
Mostly unspecific arrays that can be made more specific. This patch
intentionally doesn't touch any code, only comments.

Change-Id: I5b4690e6160c6c543f9fcb2f62c41f6329d48bdb
2024-08-27 16:54:41 +00:00
thiemowmde ffafba0695 Remove meaningless return true from hook handler functions
Returning true is the same as returning nothing. It's only meaningful
when a hook handler can also return false. Some actually do this.
I'm not touching these.

See Icccf60b for the reasoning why the added `@return void` are
beneficial.

Change-Id: I6de7addee853ff183058e6c84e87a5b275c785e8
2024-08-27 08:47:46 +00:00
Umherirrender db8f22c1d4 Use namespaced classes
Changes to the use statements done automatically via script

Change-Id: Iedad37d75aee4d2a6960ab20148f813c6cf7061a
2024-06-10 20:41:43 +02:00
Wandji69 a7111aac69 Use ObjectCacheFactory instead of deprecated ObjectCache method
Bug: T363770
Change-Id: I416c511ef22afde3d519f66818c9b64e0ef21178
2024-05-14 20:07:42 +00:00
wfan fed1972733 Migrate MediaWiki.scribunto.traces.* to statslib
Bug: T359275
Change-Id: Idd234bbb34747b4557dcded73eace69131a2566a
2024-05-04 22:40:52 -07:00
thiemowmde fbbb56f1ef Stop using the Xml class in this codebase
Bug: T341775
Change-Id: I2ccecaccf1558d9c54d88e2d1f43ca59d7157d15
2024-04-26 13:20:06 +02:00
Fomafix 2a45dbb577 Inject services into ApiScribuntoConsole, CodeEditorHooks and Hooks
Also use private instead of public for internal function reportTiming.

Change-Id: I52c301d11244436ddc142ec84a7c6740a4ea4d32
2024-03-18 04:40:47 +00:00
Fomafix 70605bf630 Replace global configuration variables
Use overrideConfigValues instead of setMwGlobals in tests.

Change-Id: Icaf7d8d9bb3a4c1eb981ef83a12719c2619039fa
2024-03-18 04:40:44 +00:00
Umherirrender 68aebf853c Use namespaced classes
This requires 1.42 for some new names

Done automatically via script

Change-Id: I6f6899981eab571cabb57534d7d98ce546a30a75
2024-01-05 19:24:06 +01:00
C. Scott Ananian 1eea8281c9 Assign UUIDs to Scribunto errors independent of page parse order
This replaces the use of ParserOutput::addJsConfigVars(), deprecated
since 1.38, and ensures that the IDs used for error messages are
independent of page parse order. (See T300979.)

This is an improved replacement for Ibd3fbcbc774491179b0d4fe29ba3b6a128220703
which was reverted (T346094).

Bug: T300307
Bug: T305161
Bug: T346094
Change-Id: I2c660972b289bbad730ceee1325d70d5ba75d27e
2023-10-13 15:23:22 +00:00
Jdlrobson 77286ebc87 Revert "Replace use of ParserOutput::addJsConfigVars(), deprecated since 1.38"
This reverts commit 9f8d16f9c9.

Reason for revert: Causes internal error on certain pages.

Bug: T346094
Change-Id: Ia9ccffbbbe2fe2413b54fb5e16f5cfc53527990e
2023-09-11 20:18:13 +00:00
C. Scott Ananian 9f8d16f9c9 Replace use of ParserOutput::addJsConfigVars(), deprecated since 1.38
Most uses can be replaced with ::setJsConfigVar(); the major semantic
change is that ::setJsConfigVar() is not expected to overwrite
previous values.  That *may* be an issue here, but if so it's not
a change from existing behavior, as the way ::addJsConfigVars() was
being called it would override previous values as well.

Bug: T300307
Bug: T305161
Change-Id: Ibd3fbcbc774491179b0d4fe29ba3b6a128220703
2023-09-11 16:55:54 +00:00
Umherirrender a8280e5e5f Use namespaced Title
Bug: T321681
Change-Id: I65940dc6d276f86734ff724d6605facb68dd8e44
2023-08-19 20:18:41 +02:00
Umherirrender a00ce79826 Use HookHandlers for CodeEditor hook
This requires 1.41 for the interface (added in 4d6a470a)

Bug: T271026
Change-Id: I393ba99b7265dac81c7fdaf3d21630386c7c53a9
2023-08-15 13:50:13 +02:00
Umherirrender 648985c981 Use HookHandlers for core hooks
The use of "HookHandlers" attribute in extension.json makes it possible
to inject services into hook handler classes in a future patch.

Bug: T271026
Change-Id: I1583f5075937c4ce71a0d8748700f7012280851c
2023-08-15 13:49:53 +02:00
Daimona Eaytoy 846495fe45 Replace deprecated MWException
Bug: T328220
Change-Id: I38be06abdabff29276f07c378f3ef434973fb8d6
2023-06-09 14:43:44 +02:00
gerritbot 7cf0fa1edb Update moved class EditPage
See T321882. Moved in Ibefc44eb64aed

Bug: T321681
Change-Id: I52f974372fe79145ddbb59fbbd4ec8dbf9c83e23
2023-05-07 00:32:11 +00:00
gerritbot 756926c479 Update moved class WikiMap
See T321882. Moved in I60cf4b9ef02b9d5

Bug: T321681
Change-Id: I4bd035a77ac80e9b408e63b35f3116e1901df7cb
2023-04-25 09:54:46 +00:00
Reedy 033c69cfab ScribuntoException: Use value property not dynamic property
Bug: T330524
Change-Id: I69a102497fffb939c849d2836302068ac9eff3d0
2023-02-25 00:57:56 +00:00
Thiemo Kreuz 912324993f Apply some minor PHP code modernizations
* Make use of the ?? syntax.
* Use an upstream function.
* Fix an incomplete type hint.

Change-Id: I7b1916418f4b1e65cc8396cfd646224f55c137a4
2022-09-29 21:45:09 -04:00
Kunal Mehta 4ccebcdf4b Simplify creating JSON pages in the Module namespace
Pages ending with a ".json" suffix in the Module namespace will use the
built-in JSON content model by default. Previously editors had to use
Special:ChangeContentModel to get a JSON page, which requires the
"editcontentmodel" userright that is not granted to a wide set of users
by default.

Bug: T144475
Change-Id: I1546fcad823a55a8c5a93177df8715844de1e87c
2022-09-22 19:48:52 -07:00
Alexander Vorwerk 738ca8d72d Bump scribunto-stats cache version
The addition of PSquare::__serialize() in wikimedia/running-stat is
having the same cache implication as the issue this was meant to fix.

The legacy PHP serialized form is not compatible with the stable
serialize form that we're switching to.

Bug: T313341
Change-Id: Iec4c1c958e10560abcbd4184a0ca4e1a0c19183a
2022-08-16 19:09:36 +00:00
Timo Tijhof e9988b8473 Hooks: Minor clean up, remove redundant PSquare check
PSquare is part of wikimedia/running-stat which is bundled with
MediaWiki core. There is no valid way to install a wiki without
the vendor libraries present.

The check was introduced in 2015 with I0d39920733fe7 when the class
was newly added to the package and deployment was happening
concurrently to the extension change.

Bug: T313341
Change-Id: I6717151c39b589f2e5b5e87da6896f62252cb5d8
2022-07-19 14:58:17 -05:00
Timo Tijhof e5362f639e Hooks: Bump scribunto-stats cache version
The Wikimedia\PSquare class has changed such that its serialization
is incompatible with its prior version. We should probably refactor
this to use an actually supported serialization format, possibly
by enhancing PSquare with some kind of getter method that provides
a plain array that its constructor can accept again instead of relying
on internal PHP serialisation format, but for now we can bump the
cache version.

The side-effect of this will be that the performance stats captured
by Scribunto for visualiation in Grafana, will briefly split its
sampling logic between two versions instead of being global across
all wikis until the train is fully deployed. This does not have any
effect on its business logic or runtime behaviour, and is presumably
by design as that's the only way to bump the cache version, which was
a pre-existing factor in its cache key.

Basically, this means that during the deployment days on weeks where
this is bumped, we will briefly capture fewer samples as there are then
two separate counters trying to reach 1000 before flushing a median
to Graphite. We can remedy that by backporting and deploying to both.

While at it, I'm changing the cache key to conform to our conventions
and make it an explicit, greppable, lowercase and descriptive name
(scribuntu-stats) instead of the implicit __METHOD__ which expanded
to "Scribunto\Hooks::reportTiming". I note that this means the split
brain sampling actually happened at least once before during the week
where the namespace was introduced as that will have implicily changed
the cache-key. Another reason not to use __METHOD__ in a cache key.

Bug: T313341
Change-Id: Ic9dad0f55cba18ec03272b87366a091a396beb74
2022-07-19 14:53:53 -05:00
Reedy 8e73003fee Start namespacing extension
Change-Id: Ib632434861c2df03dfcddbd195f556c937812196
2022-05-12 01:33:11 +00:00
Renamed from includes/common/Hooks.php (Browse further)