Commit graph

39 commits

Author SHA1 Message Date
Umherirrender
e662614f95 Use explicit nullable type on parameter arguments
Implicitly marking parameter $... as nullable is deprecated in php8.4,
the explicit nullable type must be used instead

Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a

Break one long line in SpecialPage.php

Bug: T376276
Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
2024-10-16 20:58:33 +02:00
thiemowmde
b1c9ec74fa Remove meaningless @var documentation from constants
A constant is not a variable. The type is hard-coded via the value
and can never change. While the extra @var probably doesn't hurt much,
it's redundant and error-prone and can't provide any additional
information.

Change-Id: Iee1f36a1905d9b9c6b26d0684b7848571f0c1733
2024-10-09 09:33:12 +02:00
jenkins-bot
6aff64e157 Merge "ResourceLoader: Fix content-links compat" 2024-09-24 22:17:54 +00:00
Jon Robson
a09791e942 Support legacy message boxes in user generated content
* Deprecate SkinModule feature 'interface-message-box"
* Include styles using dedicated module where needed for content.

Bug: T375127
Depends-On: I58d9e41f0c98adbd816240b161b5145a667436cd
Change-Id: I59ab5f222dc9d01de04077d3e2cef5b42a8ffe08
2024-09-18 21:02:59 +00:00
Timo Tijhof
e03380c714 ResourceLoader: Fix content-links compat
This never worked because it looked for `element` instead of `elements`.
The test repeated the same mistake.

Bug: T278576
Bug: T255717
Change-Id: I9bfceb6b8bd761244af6eda0e2ae08e98238aa76
2024-09-17 03:22:14 +00:00
Timo Tijhof
123da635a1 ResourceLoader: Fix SkinModule aliases to not override existing keys
While not documented or tested, aliases previously not only adding
but also replaced values.

Instead, emit a warning to inform skin developers of this conflict.

Note that the `content-links => elements` alias already behaves
this way (only if not already set), which the other aliases would
now be consistent with.

Change-Id: I66ae66b37bba14b2f65710f3d32f17d4e9a5a7a3
2024-09-17 03:22:04 +00:00
Timo Tijhof
3d924e4ed1 ResourceLoader: Minor doc blocks and coding style cleanup
* Function alls are either complete on one line or one arg
  per line. Avoid confusing calls where the args are on their
  own line as this creates visual ambiguity over how many args
  are passed, and what each piece belongs to. For example, is
  `true` or `false` passed as 2nd arg to applyFeaturesCompatibility?

* Replace comment about list-form behaviour with something that
  provides intention and insight instead of merely repeating what
  can already be seen from the code.

* Fix malformed `@param` docs that used variable as part of sentence.

* Use named data providers to ease PHPUnit debugging,
  and to make code coverage reports on doc.wikimedia.org more useful.

Change-Id: I2efd6cc7ac59c80684c9411025c4226473a36d43
2024-09-17 03:20:15 +00:00
Timo Tijhof
3ee96d47b6 ResourceLoader: Reduce deprecation clutter in SkinModule
* Move docs for deprecated aliases from top-level mentions into
  footnotes under primary docs. Still easy to search for, but no
  longer advertised as important for skin devs to know about
  or scan past when reading.

* Fix bug in 'legacy' logic where the key was not unset, thus
  mandating a needless entry in FEATURES constant. With the bug
  fixed, this internal entry is no longer needed.

* Fix bug in 'interface' logic where the key was not unset
  when the value is false. This would break the "skins.vector.styles"
  module otherwise, and had a similar workaround in place that
  is now no longer needed.

* Remove other unneeded entries in FEATURES for keys that were
  already being unset by applyFeaturesCompatibility().

* Remove deprecation warnings in favour of letting ResourceModules
  give a stable interface from ResourceLoader to skin.json.

* Add missing test to confirm no-op behaviour.

Bug: T374262
Change-Id: I9f4b1d48127d0afe67bada44d8dc4472507f9506
2024-09-16 20:17:34 -07:00
Ebrahim Byagowi
80a2a97e79 ResourceLoader: Revive i18n-all-lists-margins feature of SkinModule
* Corrects the previous deprecation to restore backwards compatible functionality to i18n-all-lists-margins for skin developers without
any change on their part.
* Updates deprecation message to give clearer next steps.

Bug: T369475
Change-Id: I98696b4a52838a4836320a491430e669e3a5d1e1
2024-09-16 23:18:51 +00:00
Ebrahim Byagowi
c9a1fc3f02 Minor comment tweak in SkinModule
Just make all the parts similar.

Change-Id: Iee79eef2d86dde7f75a4a2d090d976ad0a964826
2024-08-25 17:02:06 +03:30
Ebrahim Byagowi
aab32745ee Turn ToC's common and print to LESS
So LESS styles can be moved between them with more ease.

Change-Id: I6f49185baed11ac5743156d45c0806e7f9644e89
2024-08-05 05:41:47 +00:00
Ebrahim Byagowi
0a6efabf86 Make dd, ol and ul margin values direction aware
For years we had to carefully use mw-content-ltr and mw-content-rtl
subsections to make description, ordered and unordered lists margin
values to work in LTR and RTL mixed content as expected. Now with the
widespread existence of CSS Logical
https://caniuse.com/?search=css-logical
such workarounds aren't needed as now we can just define styles in a
direction aware way.

The only problem is that older browsers which don't support
CSS Logical, that's why this change actually keeps compatibility
margin values for them so they can just ignore those new properties
and the remaining issue will be the support of nested directions for
that older browsers which should be negligible given the benefits
for the newer browsers such as the support of more than two layers
of direction changes (happens in multilingual wikis such as Commons
but rarely) and the fact margin values now will be correct even when
`mw-content-{ltr,rtl}` classes aren't used correctly by the templates
in wikis (which happens more commonly).

The purposed change uses https://caniuse.com/?search=margin-block-start
over https://caniuse.com/?search=margin-block which has even slightly
better browser support.

This change deprecates `i18n-all-lists-margins` module of SkinModule
as now just including of the `elements` module is enough.

Bug: T369475
Change-Id: I404710209d59241991716bb7180bcaabcafffcec
2024-07-24 13:07:35 -07:00
Func
382f8c34a2 SkinModule: Always pass language code to get logos
Bug: T369537
Change-Id: I0f71cb839e23e8989cec72fef6f643ed4408839a
2024-07-09 02:12:02 +08:00
Jan Drewniak
9b3a215975 Output skin related styles after SkinModule feature styles
Changes SkinModule::getStyles to output config features
first, then skin customization styles last. This requires
using the ResourceLoader::makeCombinedStyles method to
first combine feature styles, then combine style related styles,
and return the concatenated result in SkinModule::getStyles().

The resulting stylesheet ordering is changed so that all
skin customization styles are always output after core styles,
which allows skins to override core-styles via cascade order instead
of increased specificity.

Previous output order:
- all (core+custom)
- print (core+custom)
- screen (core+custom)
- other custom

New output order:
- all (core)
- print (core)
- screen (core)
- other (core)
- all (custom)
- print (custom)
- screen (custom)
- other (custom)

SkinModule is refactored to separate logo-related style
generation, as well as skin feature generation, in order to maintain
testability. Tests are also refactored to better cover different
skin feature configurations.

Bug: T354975
Change-Id: I261742c0ae4c3d57353bf1854af66f39df6132f7
2024-02-29 11:56:57 -05:00
Esanders
9783ee9482 Revert "SkinModule - Ensure skins can easily override skin feature styles"
This reverts commit afdc92987f.

Also reverts Ib44687b which was a follow-up.

Reason for revert: Caused T357929

Bug: T357929
Bug: T354975
Change-Id: Ic6d0b472cc2b26cb7c375bf9a5d2e03a4d6c6a18
2024-02-19 18:52:53 +00:00
Jon Robson
34dda35d04 Fixes issue with unusual mediaTypes
Flagged by Leon in T354975#9548451

Bug: T354975
Change-Id: Ib44687b6c0dffdb25d9726afa0c7c0e7c6ea12f5
2024-02-15 12:10:10 -08:00
jenkins-bot
70942c2378 Merge "SkinModule - Ensure skins can easily override skin feature styles" 2024-02-15 00:21:29 +00:00
Jan Drewniak
afdc92987f SkinModule - Ensure skins can easily override skin feature styles
Reorders ResourceLoader\\SkinModule style output so that all styles
produced by skins are output after styles that are produces by
skin "features" such as normalize.

Refactors & expands SkinModuleTest.php to include tests for default
values, print styles and correct style ordering.

Bug: T354975
Change-Id: I0000b4ad8eb2de40be293f0e693d873c282ea785
2024-02-14 17:44:01 -05:00
James D. Forrester
21d8d9863b Drop old ResourceLoader class aliases, deprecated since 1.39
Depends-On: Iff15a2e13a3507ef1ab5cfa504ca1a1c8d2b2a60
Depends-On: Icf8331e35acf6fe51a8303ee639921b9e4f3e6bb
Depends-On: I5a5af003026db69b279ddde0b0dedbfcfe7d70fd
Change-Id: I5929a2f760c8d21c1cb2542a19220a91ac7240e4
2024-01-31 18:24:37 -05:00
Amir Sarabadani
167fbd0a20 Drop deprecated config $wgLogoHD
It has been deprecated since 1.35, hard deprecated since at least I9776d11d4e2d184

No grep result in wmf-config

Change-Id: I2c67bab3e3212f25a0cbce7301f5e32a082f76da
2024-01-24 19:46:04 +01:00
James D. Forrester
c1599c91b3 Namespace Config-related classes under \MediaWiki\Config
Bug: T166010
Change-Id: I4066885a7ea071d22497abcdb3f95e73e154d08c
2023-09-21 05:41:58 +00:00
Amir Sarabadani
d8e542abf9 Reorg: Move three output related classes to includes/Output/
And namesapce them:
 - StreamFile
 - OutputHandler
 - OutputPage

Bug: T321882
Change-Id: Iedf8d88c595e580f2d8f0734c92aa5c45618ba33
2023-09-05 19:36:42 +01:00
Arlo Breault
f99dc83677 Add a config to stop shipping the legacy media styles
Since the default for wgParserEnableLegacyMediaDOM is now `false`, this
config will also be set to `false` and wikis can enable it while it's
still necessary.

The plan will be to gradually roll this change out, as was done for
wgParserEnableLegacyMediaDOM, to develop a migration path for templates
and extensions that mimic the legacy media output.

We can start on officewiki.

Bug: T318433
Change-Id: I70e537b2beb99de9a41e7dc66a0d60a508009887
2023-07-12 18:32:31 -04:00
Jan Drewniak
2eedee7974 Create mediawiki.tempUserBanner module
Creates a new resourceLoader module which holds the
scripts and styles related to the temp user (IP masking) banner
described in T339379.

The temp user banner includes a tooltip which explains
what temporary accounts are. This is built using OO.ui.PopupWidget
and includes a clock icon and parsed i18n messages.

The Tooltip dependencies are loaded and instantiated on a click event
in order to minimize the dependencies on page load.

Bug: T339379
Change-Id: Ie2631221b0a07dd3bf55e970805d30fbb3cac190
Depends-on: Id5a4a9a00e50420c50868c54f899d36d7ddd373d
Depends-on: Icf622c4be910f5d14de95355efa02c05930179bf
2023-06-30 00:41:46 +00:00
Jon Robson
e2b183c1f5 Hide temporary banner in print
Bug: T339379
Change-Id: I9dcc5a2a7cbc09377d8867b2e3ec63e8f03874bf
2023-06-27 20:33:49 +00:00
jenkins-bot
311aa88025 Merge "Use Codex markup on message box component" 2023-06-16 22:47:04 +00:00
Jon Robson
0be2bdd9c7 Use Codex markup on message box component
This will allow interfaces using Codex to style message boxes
consistently on the server side.

Skins can now remove the ResourceLoaderSkin message box module
and instead load the codex-styles module.

Since certain JavaScript may be looking for the existing classes,
these are retained for now (this prevents Selenium tests failing)

Depends-On: I3959c8f8d4c7bbe019f5e3b356649b5b7dc88907
Depends-On: I45c60e9f5cbb57eae61c9487f120b9165bf5a190
Bug: T326587
Change-Id: I16d8f53b9a83a468acdb3803044f6c4e9d5dfeeb
2023-06-16 14:29:57 -07:00
Jan Drewniak
62196c2fa1 Create new TempUserBanner skin component
Creates a new skin component for informing users with
temporary accounts that they can login or register if they choose.

Adds:
- New skin component: SkinComponentTempUserBanner.php
- Skin feature: "temp-user-banner"
- Associated styles
- New i18n messages for banner

NOTE: This component is not registered via the skinComponentRegistry
because it doesn't output any data, only a string of HTML.
Instead it is appended to the body element before the skin is rendered.

Bug: T330510
Change-Id: I1e137dbd29f3c73efac901f43f8a8258e2a111fc
2023-06-16 16:50:06 +00:00
Tim Starling
25d0d37adc ResourceLoader: tweak comments and error messages
Change-Id: Ifcaefedf65b090a87ec1417808277ae6451302dc
2023-04-03 18:21:30 +10:00
Bartosz Dziewoński
d3c64c5ce6 ResourceLoader: Remove SVG fallback hack from SkinModule
Bug: T329127
Change-Id: I28c02efc137c3a9ceacdc07366ac374c70b0fb7e
2023-02-08 00:32:52 +00:00
Kosta Harlan
78916de4aa ResourceLoader: Define targets in a single location
All the *Module classes end up inheriting from ResourceLoader/Module, so
we only need to define the targets there.

Bug: T127268
Bug: T328497
Change-Id: I12b126377cea78b88269e6efe68f92f3586c4ecc
2023-02-02 16:27:08 +00:00
Tim Starling
0077c5da15 Use short array destructuring instead of list()
Introduced in PHP 7.1. Because it's shorter and looks nice.

I used regex replacement.

Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
2022-10-21 15:33:37 +11:00
Jon Robson
e8096656e7 ResourceLoaderSkinModule: Document new interface styles
Follow up to Ib5ae640bb260cee46e654228b785c776722c7003

Bug: T316027
Change-Id: Ia6af9fb213d8bd5b18ec95371489cfa0bdf7ed64
2022-08-26 14:19:20 +00:00
Jon Robson
ac389cf0f0 ResourceLoaderSkinModule: Split up interface feature into multiple parts
While working on the site notice in Vector we've noticed these
styles are proving more problematic than helpful so splitting these
up allows us more granularity in the styles we ship.

The core interface styles are now enabled by default as they contain
important logic relating to empty portlets and the print footer

Bug: T316027
Change-Id: Ib5ae640bb260cee46e654228b785c776722c7003
2022-08-24 13:59:17 +00:00
Timo Tijhof
ca4e16393b resourceloader: Resolve SkinModule wordmark/tagline tech debt
This was added as a workaround for the invalid values committed to
Beta Cluster config in I021e7b4003a. As I wrote then, boolean false
is not a valid value there for SkinModule. Instead of fixing this,
it was worked around in core with 4de725083 (Ie86a5b59).

Thiemo and Tim fixed the invalid Beta config last week with
164945371a (Id2712e2a), which was done as part of fixing outstanding
PHP 7.4 warnings, because despite the core workaround above, another
change to SkinModule later on introduced the same reasonable
assumption in another part of the code, that it would not be
invalid/false, but only null or string.

See also CR at:
* <https://gerrit.wikimedia.org/r/663263> (invalid config)
* <https://gerrit.wikimedia.org/r/719308> (original core change)
* <https://gerrit.wikimedia.org/r/719500> (revert core change)

Bug: T207038
Bug: T310767
Change-Id: Ieeff6198dff34de16dadb5c0347dbdae7bcf3a08
2022-06-21 20:23:48 +01:00
Tim Starling
a5b44d60f1 resourceloader: Don't raise notice when the logo wordmark is false
Fix notice on PHP 7.4+ when the wordmark is false. It is false on the
beta cluster and Mustache doesn't mind if it is false. Update docs.

Use !empty($x) as a shortcut for isset($x) && $x in two nearby places.

Bug: T310767
Change-Id: Ie33f8edf075f1216881428ec6aa29cae1dac4e64
2022-06-16 14:10:40 +10:00
Tim Starling
3e2653f83b ResourceLoader namespace (attempt 2)
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader itself.

Move the tests by analogy.

I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".

I did not address DependencyStore which continues to have a non-standard
location and namespace.

Revert of a241d83e0a.

Bug: T308718
Change-Id: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
2022-05-24 15:41:46 +00:00
Lucas Werkmeister (WMDE)
a241d83e0a Revert "ResourceLoader namespace"
This reverts commit e08ea8ccb9.

Reason for revert: Breaks Phan in extensions, and as far as I’m aware,
this change isn’t urgently needed for anything, so the simplest fix is
to revert it again for now. After PHP 7.4 it should be safer to try this
again (we hopefully won’t need the two “hack” classes by then).

Bug: T308443
Change-Id: Iff3318cbf97a67f821f78e60da62a583f63e389e
2022-05-16 14:43:33 +00:00
Tim Starling
e08ea8ccb9 ResourceLoader namespace
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader and
ResourceLoaderContext.

Move the tests by analogy.

I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".

I did not address DependencyStore which continues to have a non-standard
location and namespace.

Change-Id: I92998ae6a82e0b935c13e02a183e7c324fa410a3
2022-05-16 14:41:27 +10:00
Renamed from includes/resourceloader/ResourceLoaderSkinModule.php (Browse further)