Page MenuHomePhabricator

Remove legacy scripts/non-RL mode from Gadgets extension
Open, Needs TriagePublicBUG REPORT

Description

I think it is time we remove the non-RL mode from Gadgets.

  1. Turn makeLegacyWarning into a log deprecate.
  2. Track on the deprecation dashboard.
  3. Inform wikis of their old/broken gadgets
  4. When satisfactory, remove code of the old legacy gadgets from the extension.

Background

  • Disabling "legacy" gadgets

See also:

Warning on Special:Gadgets:

Gadget is not loaded. Please migrate to ResourceLoader. (Learn more)
{F62358421 height=100}

Warning in the browser console:

Gadget "RegeMenuFramework" was not loaded. Please migrate it to use ResourceLoader. See https://beta.wikiversity.org/wiki/Special:Gadgets.
{F62358424 height=100}

Event Timeline

hhmm. this legacy warning is injected before we have full mw.log it seems. that makes tracing them a bit hard. I guess we can scan each page and see if there is still a wiki out there with that flag..

pattern: /^\*.*\[((?!ResourceLoader).)*\].*\.js.*$/gm

Change #1155179 had a related patch set uploaded (by SD0001; author: SD0001):

[mediawiki/extensions/Gadgets@master] Remove legacy mode and treat all gadgets as being in RL mode

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

It seems Elastic doesn't support the (?!word) negative lookahead syntax (i.e. Perl-like), so the above example doesn't work correctly, when run on the Global Search tool, or via mwgrep.

But, it does support a "complement" operator (docs) which does something similar:

mwgrep --title Gadgets-definition '\*~(.*(ResourceLoader).*)\.js'
## Public wiki results
arwikiquote         MediaWiki:Gadgets-definition
betawikiversity     MediaWiki:Gadgets-definition
enwikinews          MediaWiki:Gadgets-definition
eswiki              MediaWiki:Gadgets-definition
fawikisource        MediaWiki:Gadgets-definition
fawikivoyage        MediaWiki:Gadgets-definition
gewikimedia         MediaWiki:Gadgets-definition
huwikinews          MediaWiki:Gadgets-definition
itwikisource        MediaWiki:Gadgets-definition
kawiki              MediaWiki:Gadgets-definition
ladwiki             MediaWiki:Gadgets-definition
ltwiki              MediaWiki:Gadgets-definition
mkwiki              MediaWiki:Gadgets-definition
mkwikisource        MediaWiki:Gadgets-definition
mlwikibooks         MediaWiki:Gadgets-definition
mlwikisource        MediaWiki:Gadgets-definition
nlwikibooks         MediaWiki:Gadgets-definition
pawikisource        MediaWiki:Gadgets-definition
pswikivoyage        MediaWiki:Gadgets-definition
ptwikiquote         MediaWiki:Gadgets-definition
ptwikiversity       MediaWiki:Gadgets-definition
sawikisource        MediaWiki:Gadgets-definition
simplewiki          MediaWiki:Gadgets-definition
simplewikibooks     MediaWiki:Gadgets-definition
simplewikiquote     MediaWiki:Gadgets-definition
slwiki              MediaWiki:Gadgets-definition
slwikiquote         MediaWiki:Gadgets-definition
slwikisource        MediaWiki:Gadgets-definition
slwikiversity       MediaWiki:Gadgets-definition
strategywiki        MediaWiki:Gadgets-definition
tenwiki             MediaWiki:Gadgets-definition
wikimania2014wiki   MediaWiki:Gadgets-definition
zhwiki              MediaWiki:Gadgets-definition

Global Search for the above query.

The list is short enough to be a plausible list of lefovers. Spot-checking this indeed seems correct:

  • arwikiquote contains * ShortLink|ShortLink.js and various others like it.
  • zhwiki contains * mainpage-customization|mainpage-customization.js although it is commented out, it is a genuine match.

I've added the following context to the task description:

See also:

Warning on Special:Gadgets:

Gadget is not loaded. Please migrate to ResourceLoader. (Learn more)
{F62358421 height=100}

Warning in the browser console:

Gadget "RegeMenuFramework" was not loaded. Please migrate it to use ResourceLoader. See https://beta.wikiversity.org/wiki/Special:Gadgets.
{F62358424 height=100}

Hi! I just re-run the global code search and it seems like several wikis already removed their legacy gadgets.

So as a global interface editor, I commented-out the remaining ones. I think commenting-out is better than removing because:

  • Removing makes us "lose track" of the associated JS and CSS files
  • If the [ResourceLoader] flag is removed from all wikis programmatically (not sure if this was ever the intention) the legacy gadgets will remain commented-out
  • If someone wants to re-enable a legacy gadget after so many years, we can expect they'll do some basic testing and fixes, and not just assume it will work

Hopefully this will unblock this task, but if any more changes are needed, let me know and I'll be happy to help.