On Tue, Mar 29, 2016 at 5:05 AM, Mr. Stradivarius misterstrad@gmail.com wrote:
Fixing this properly would require a lot of things to happen. For example, I think we will need:
- A clear guide on how to update the deprecated code. The mailing list
announcement [2] and the legacy javascript page [3] are a good start, but having one document with code examples that is specific to the change would make it easier for less experienced script writers to work out how to update their code.
- A short, easy-to-understand guide for end users who are just loading
scripts with importScript.
[..]
https://en.wikipedia.org/wiki/Wikipedia:Village_pump_%28technical%29#Breakin... https://lists.wikimedia.org/pipermail/wikitech-l/2016-March/085113.html https://www.mediawiki.org/wiki/ResourceLoader/Legacy_JavaScript
Thanks Strad. As mentioned, the mailing list and Tech News went out. I've gone ahead and updated these as well:
https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_%28users%29 https://www.mediawiki.org/wiki/ResourceLoader/Legacy_JavaScript https://www.mediawiki.org/wiki/ResourceLoader/Modules#mediaWiki.loader
Usage in site-wide scripts (such as Common.js and Gadgets) are mostly updated already.
It's mainly user scripts that use importScript a lot. A massive find-and-replace from importScript to mw.loader.load() could be done.
However, for larger wikis it may be desirable to "simply" re-define importScript in MediaWiki:Common.js as shortcut for mw.loader.load. This is guaranteed to be available before any user modules.
A local definition allows wikis to migrate (or not) at their own pace. Either by a massive find/replace action in the future, or by informing users of particular scripts to replace one snippet with another (from a documentation page specific to that script). This is similar to how script authors may currently try to get users to update their installation (e.g. if the script moved or changed significantly).
However I do want to emphasise that for importScript in particular, there is no rush. If we need to keep an alias around indefinitely on most larger wiki's Common.js, that seems fine. Same for addOnloadHook (though that one is significantly easier to update).
The main thing we're trying to clean up here is the dozens of legacy global functions and variables that are largely unused. Such as 'clientPC', 'ie6_bugs', 'escapeQuotesHTML', 'killEvt' etc. And the negative performance impact of having to load it before all other modules.
On Tue, Mar 29, 2016 at 5:05 AM, Mr. Stradivarius misterstrad@gmail.com wrote:
- A list of which users are affected, and what scripts they would need to
fix.
I would advise against that. In my experience, the vast majority of user scripts are not "written" by users, but were composed of install instructions from another wiki page (e.g. "To enable X, copy this snippet to Special:MyPage/common.js, and save"). I don't think we should burden them with the updating of such snippet themselves.
However we should definitely reach out to authors of wiki pages (e.g. documentation pages for user scripts) to ensure that installation instructions and snippets are up-to-date.
-- Krinkle
[1] https://www.mediawiki.org/wiki/ResourceLoader/Legacy_JavaScript