[go: up one dir, main page]

Page MenuHomePhabricator

Skins should no longer output HTML and head tag
Closed, ResolvedPublicBUG REPORT

Description

NOTE: Impacted skins and extensions are listed here https://codesearch.wmcloud.org/search/?q=(bottomscripts%7Cheadelement)&i=nope&files=&excludeFiles=&repos= NOTE: To address this problem please stop calling these functions. You can see https://phabricator.wikimedia.org/rSCAVab2b4414a0f405318b5ccea89225f1aa50b90591 for an example.

In 1.39 skins following T62846 using SkinTemplate will trigger a deprecation notice Deprecated: Use of QuickTemplate::(get/html/text/haveData) with parameter bottomscripts` was deprecated in MediaWiki 1.39. [Called from QuickTemplate::get in /vagrant/mediawiki/includes/skins/QuickTemplate.php at line 144] in /vagrant/mediawiki/includes/debug/MWDebug.php on line 380`. On the long term this will ensure that all extension code is rendered by a skin and head tags are consistent.

There are no plans on the short term to break these skins, but a lot of skins are impacted and we should endeavor to fix as many of them as possible.

Any help is greatly appreciated and will be reviewed within 48hrs provided it's associated with this ticket.

The fix is relatively simple:

  1. Skins should add skin option bodyOnly: true to skin.json
  2. Skins should remove any echo statements that echo bottomscripts, headelement or getTrail

Examples:

Impacted skins

Last updated May 13th 2022:

  • neptune
  • material
  • osmfoundation
  • strapping (mediawiki-strapping)
  • tyrian
  • bluell
  • pure
  • hive
  • p2wiki
  • cosmos
  • hassomecolours
  • amethyst
  • nimbus
  • metrolook
  • gamepress
  • woogleshades
  • poncho
  • bluesky
  • greystuff
  • pivot
  • foreground
  • tweeki
  • truglass
  • gumaxdd
  • splash
  • wptouch
  • deskmessmirrored
  • bouquet
  • dusk
  • dusktodawn
  • refreshed
  • medik
  • liberty
  • darkvector
  • aether https://invent.kde.org/websites/aether-mediawiki/-/merge_requests/4
  • apex
  • anisa
  • erudite
  • mask
  • tempo
  • wikimediaapiportal https://gerrit.wikimedia.org/r/c/mediawiki/skins/WikimediaApiPortal/+/786397
  • webplatform
  • jony
  • modernskylight
  • darkcosmos
  • scratchwikiskin2
  • onyx
  • simpletext
  • s2018
  • monaco
  • cavendish
  • cavendish-brown
  • cavendish-green
  • mediawikibootstrap
  • peruna
  • collegeinsider
  • cemublue
  • library
  • t29v7
  • atlasmuseum
  • eveskin
  • wisky

TODO

  • Remove the code
  • Email wikitech-l describing how to fix broken skins

Details

SubjectRepoBranchLines +/-
mediawiki/coreREL1_43+29 -33
mediawiki/coremaster+29 -33
mediawiki/coremaster+73 -86
mediawiki/skins/mediawiki-strappingREL1_39+2 -7
mediawiki/skins/MaterialREL1_39+21 -24
mediawiki/skins/mediawiki-strappingmaster+2 -7
mediawiki/skins/MetrolookREL1_39+28 -12
mediawiki/skins/Metrolookmaster+28 -12
mediawiki/skins/Materialmaster+21 -24
mediawiki/skins/DeskMessMirroredmaster+23 -47
mediawiki/skins/DuskToDawnmaster+22 -30
mediawiki/skins/Duskmaster+20 -21
mediawiki/skins/Bouquetmaster+26 -36
mediawiki/skins/DeskMessMirroredREL1_39+23 -47
mediawiki/skins/BouquetREL1_39+26 -36
mediawiki/skins/DuskREL1_39+20 -21
mediawiki/skins/DuskToDawnREL1_39+22 -30
mediawiki/skins/GamepressREL1_39+9 -46
mediawiki/skins/Gamepressmaster+9 -46
mediawiki/skins/Nimbusmaster+28 -12
mediawiki/skins/NimbusREL1_39+28 -12
mediawiki/skins/RefreshedREL1_39+22 -34
mediawiki/skins/Refreshedmaster+22 -34
mediawiki/skins/apexmaster+40 -69
mediawiki/skins/apexREL1_39+40 -69
mediawiki/skins/PonchoREL1_39+3 -9
mediawiki/skins/Ponchomaster+3 -9
mediawiki/skins/GuMaxDDmaster+28 -469
mediawiki/skins/TruglassREL1_39+17 -38
mediawiki/skins/Truglassmaster+17 -38
mediawiki/skins/CosmosREL1_39+4 -8
mediawiki/skins/GreyStuffREL1_39+14 -57
mediawiki/skins/GreyStuffmaster+14 -57
mediawiki/skins/SplashREL1_39+5 -11
mediawiki/skins/HasSomeColoursREL1_39+14 -21
mediawiki/skins/AnisaREL1_39+13 -21
mediawiki/skins/Anisamaster+13 -21
mediawiki/skins/HasSomeColoursmaster+14 -21
mediawiki/skins/WoOgLeShadesmaster+12 -12
mediawiki/skins/Splashmaster+5 -11
mediawiki/skins/Cosmosmaster+4 -8
mediawiki/skins/AmethystREL1_39+12 -4
mediawiki/skins/Amethystmaster+12 -4
mediawiki/skins/BlueSkymaster+14 -12
mediawiki/skins/Tempomaster+2 -5
mediawiki/skins/Maskmaster+2 -5
mediawiki/skins/eruditemaster+2 -8
mediawiki/skins/Cavendishmaster+4 -7
Show related patches Customize query in gerrit

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 832528 merged by Jdlrobson:

[mediawiki/skins/Nimbus@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832528

Change 832645 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Gamepress@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832645

Change 832666 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Gamepress@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832666

Change 832648 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/DuskToDawn@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832648

Change 832649 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Dusk@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832649

Change 832651 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/DeskMessMirrored@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832651

Change 832653 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Bouquet@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832653

Change 832645 merged by jenkins-bot:

[mediawiki/skins/Gamepress@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832645

Change 832667 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Bouquet@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832667

Change 832668 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Dusk@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832668

Change 832669 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/DuskToDawn@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832669

Change 832666 merged by jenkins-bot:

[mediawiki/skins/Gamepress@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832666

Change 832669 merged by jenkins-bot:

[mediawiki/skins/DuskToDawn@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832669

Change 832668 merged by jenkins-bot:

[mediawiki/skins/Dusk@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832668

Change 832667 merged by jenkins-bot:

[mediawiki/skins/Bouquet@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832667

Change 832670 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/DeskMessMirrored@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832670

Change 832670 merged by jenkins-bot:

[mediawiki/skins/DeskMessMirrored@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832670

Change 832653 merged by jenkins-bot:

[mediawiki/skins/Bouquet@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832653

Change 832649 merged by jenkins-bot:

[mediawiki/skins/Dusk@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832649

Change 832648 merged by jenkins-bot:

[mediawiki/skins/DuskToDawn@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832648

Change 832651 merged by jenkins-bot:

[mediawiki/skins/DeskMessMirrored@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832651

Change 832664 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Metrolook@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832664

Change 832686 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Material@master] Upgrade Material for 1.39

https://gerrit.wikimedia.org/r/832686

Change 832676 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Material@REL1_39] Upgrade Material for 1.39

https://gerrit.wikimedia.org/r/832676

Change 832693 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/mediawiki-strapping@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832693

Change 832686 merged by jenkins-bot:

[mediawiki/skins/Material@master] Upgrade Material for 1.39

https://gerrit.wikimedia.org/r/832686

Change 832697 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/p2wiki@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832697

Change 832677 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/Metrolook@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832677

Change 832678 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/mediawiki-strapping@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832678

Change 832677 merged by jenkins-bot:

[mediawiki/skins/Metrolook@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832677

Change 832664 merged by jenkins-bot:

[mediawiki/skins/Metrolook@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832664

Change 832693 merged by jenkins-bot:

[mediawiki/skins/mediawiki-strapping@master] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832693

Change 832676 merged by Jdlrobson:

[mediawiki/skins/Material@REL1_39] Upgrade Material for 1.39

https://gerrit.wikimedia.org/r/832676

Change 832678 merged by jenkins-bot:

[mediawiki/skins/mediawiki-strapping@REL1_39] Upgrade for 1.39

https://gerrit.wikimedia.org/r/832678

(This is not a blocker - this is more a message to skin developers who will see deprecation messages in 1.40 release)

Change 930261 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] WIP: BREAKING CHANGE: Remove support for skins rendering outside body element

https://gerrit.wikimedia.org/r/930261

Jdlrobson edited projects, added MW-1.41-release; removed MW-1.40-release.
Jdlrobson updated the task description. (Show Details)

Note that these have missed the boat for 1.41, so should be moved/re-evaluated for 1.42.

(This is actually trickier - as it is a breaking change for skins that return content other than HTML e.g. JSON.

Jdlrobson changed the task status from Open to Stalled.Jun 25 2024, 11:21 PM

This removal is blocked on a decision in T364696

Jdlrobson changed the task status from Stalled to Open.Aug 2 2024, 11:45 PM
Jdlrobson added a subscriber: daniel.

Not urgent, but would be nice to get this deprecation done. Since it touches OutputPage this should probably be looked at by someone in the platform team. Thanks @daniel for the input so far!

I don't quite understand the reasoning behind this. I think the basic question is: what code should be directly writing to the output buffer (and the WebResponse object)? Should skins build strings, and hand them off to core for output? Or should it be the other way around - core (and extensions) build a data structuer, and the skin generates the response?

The latter makes more sense to me, since that way, skins have ultimate control over what thy output. This way, you could make a skin that outputs only the body tag, or renders everything as PDF, or returns the data structure as JSON, or whatever.

Doing it the other way around also works, but it qould require a way for the skin to convey additional information to core - we'd end up with something like OutpuitPage again, a SkinOutput object. That seems redundant and awkward.

My take is that the skin should be ultimately responsible for generating the web response, and core should delegate that to the skin as much as possible. So ideally, OutputPage wouldn't be setting http headers directly either, because the skin ultimately decides the output.

I think the basic question is: what code should be directly writing to the output buffer (and the WebResponse object)?

Hi @daniel, this is correct. Right now the Skin and OutputPage is responsible for that, as these classes passes information back and forth to generate rendering. I'd like to make this one way with one class responsible. One thing that has been challenging with the current architecture is OutputPage is maintained by platform team and Skin is maintained by web team [ 1 ]. Since OutputPage is not extensible by MediaWiki skins and is somewhat tied to ResourceLoader that had seemed like the logical place for this code but I think we could rethink this.

My take is that the skin should be ultimately responsible for generating the web response, and core should delegate that to the skin as much as possible. So ideally, OutputPage wouldn't be setting http headers directly either, because the skin ultimately decides the output.
I don't quite understand the reasoning behind this.

My reasoning is that given the existence of the OutputPage::addHtml it would be very disruptive to move rendering to the Skin class. Instead I think the ideal architecture would be the OutputPage should be responsible for coordinating the generation of the page (e.g. model/controller) and use a Skin (e.g. View layer) to generate the HTML from the data via templates).

Historically, skins have had too much control over the output to the point that some skins have added multiple meta tags (e.g. og:image), inconsistent tags (e.g. meta[viewport]) provided unexpected JS environments - for example included static JS and CSS and excluded ResourceLoader. In addition to this the OutputPage and Skin have had overlapping responsibilities - the OutputPage generates the head element (via Outputpage::headElement but the skin has been responsible for rendering the entire HTML.

By limiting skins to <body> tag (which we've done already via the deprecation process), we can get more consistency and simplicity in the view layer. Does this make sense?

Happy to chat through in video call if that would be helpful.

By limiting skins to <body> tag (which we've done already via the deprecation process), we can get more consistency and simplicity in the view layer. Does this make sense?

It does make sense, but doign it the other way around makes even more sense to me :)

OutputPage is designed as a builder/aggregator. But it's tighly coupled to the Skin class. It would be nice if it didn't have to know about Skins, but Skins would just take the content collecetd by OutputPage and render it. That fits better with a layered model.

Thinking about it, I'm convincing myself that OutputPage should not be in charge of sending output to the client. That should be the skin's job - or the objec of whatever calls the skin and provides it with OutputPage. The further down in the stack the better. ActionEntryPoint, perhaps.

I would say that in our architecture, Skin class is hidden somewhere deep and it is not last thing to call, it's usually called by some EntryPoint, that calls OutputPage, which later on calls the Skin, and then on the return -> we still allow some modifications. In other words -> Skin::outputPage() is not the last thing that happens, therefore I'm not sure if this is supposed to echo stuff.

IMHO the best solution is having echo just in one place. This should happen or deep in code (in Skin) and then assume that nothing else will do echo. But from what I see - OutputPage is already doing some magic with AfterFinalPageOutput hook - therefore I'm not sure. Plus we had T129657 which most likely is a result of not handling the output buffer nicely.

I'm in favor of or passing the $html back to top (like OutputPage/EntryPoint), or maybe doing some Response handling (the way how psr-7/psr-15 defines it) , for example similar way what Slim Framework is doing

Change #930261 abandoned by Jdlrobson:

[mediawiki/core@master] Skin [BREAKING CHANGE]: Remove support for rendering outside body element

Reason:

It seems like this needs more discussion between web/platform team about architecture and code boundaries before we can continue with the deprecation.

This is not a super-high priority for now so I'm abandoning for the moment until it's a better time.

Thanks all for the input so far!

https://gerrit.wikimedia.org/r/930261

With the MW-1.43-release branching cut happening in 8 days, is this task still a blocker to the release?

Change #1080425 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Skin: [BREAKING CHANGE] Remove support for rendering outside body element

https://gerrit.wikimedia.org/r/1080425

@MSantos ideally yes. I've reached out to @daniel for a review of hopefully a more straightforward patch.

I think there should be a task to remove the 'bodyOnly' option from skins since it no longer does anything not only for SkinMustache now, but for everything.

I think there should be a task to remove the 'bodyOnly' option from skins since it no longer does anything not only for SkinMustache now, but for everything.

Yes that will be done in a follow up task. I dont want to treat this as a deprecation as that would cause unnecessary spam to skin developers. Doing that is blocked on this task.

Change #1080425 merged by jenkins-bot:

[mediawiki/core@master] Skin: [BREAKING CHANGE] Remove support for rendering outside body element

https://gerrit.wikimedia.org/r/1080425

Jdlrobson claimed this task.

I think there should be a task to remove the 'bodyOnly' option from skins since it no longer does anything not only for SkinMustache now, but for everything.

Yes that will be done in a follow up task. I dont want to treat this as a deprecation as that would cause unnecessary spam to skin developers. Doing that is blocked on this task.

Done => T306942 ! Thanks @Ammarpad for your help with this one!

Change #1084832 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@REL1_43] Skin: [BREAKING CHANGE] Remove support for rendering outside body element

https://gerrit.wikimedia.org/r/1084832

Change #1084832 merged by jenkins-bot:

[mediawiki/core@REL1_43] Skin: [BREAKING CHANGE] Remove support for rendering outside body element

https://gerrit.wikimedia.org/r/1084832