From 8e41082af8aa04d48267af6cccafb34fd98d0d6d Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Fri, 16 May 2014 16:04:12 +0100 Subject: [PATCH] Disable jQuery Migrate by default (enable via $wgIncludejQueryMigrate) Follows-up e5502d1f and 63c36506. Per the plan[1], after a few weeks of migration, the jQuery Migrate plugin will be disabled in MediaWiki core. The added configuration variable allows sysadmins to continue to use code that is not yet compatible with jQuery 1.9 and higher (e.g. extensions and/or gadgets that still use legacy jQuery functionality). [1] http://www.mail-archive.com/wikitech-l@lists.wikimedia.org/msg75735.html Bug: 44740 Change-Id: If1c9ab722c7ce025b550b457506dcdf90d3326c3 --- RELEASE-NOTES-1.24 | 5 ++++- includes/DefaultSettings.php | 9 +++++++++ resources/Resources.php | 12 ++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index 0389b7c1a5..d524b6bf75 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -35,7 +35,10 @@ production. * (bug 49156) Added the mediawiki.cookie ResourceLoader module, which wraps jQuery.cookie so that getting/setting a cookie is syntactically and functionally similar to using the WebRequest#getCookie/WebResponse#setcookie methods. -* (bug 44740) jQuery upgraded from 1.8.3 to 1.11.1. +* (bug 44740) jQuery upgraded from 1.8.3 to 1.11.1. A new configuration option, + $wgIncludejQueryMigrate, also loads the jQuery Migrate hack to let extensions + and gadgets use the long-deprecated functions that were removed in jQuery 1.9. + This option is turned off by default, and will be removed in MediaWiki 1.25. * Changes to content typography (fonts, etc.). See https://www.mediawiki.org/wiki/Typography_refresh for further information. * WikitextContent will now render redirects with the expected "redirect" diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index ab0ffebbbe..1727aeddfb 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3221,6 +3221,15 @@ $wgResourceLoaderMinifierMaxLineLength = 1000; */ $wgIncludeLegacyJavaScript = true; +/** + * Whether to include the jQuery Migrate library, which lets legacy JS that + * requires jQuery 1.8.x to work and breaks with 1.9.x+. + * + * @since 1.24 + * @deprecated since 1.24, to be removed in 1.25 + */ +$wgIncludejQueryMigrate = false; + /** * Whether to preload the mediawiki.util module as blocking module in the top * queue. diff --git a/resources/Resources.php b/resources/Resources.php index aee1864d2c..9ff78904e8 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -186,10 +186,14 @@ return array( /* jQuery */ 'jquery' => array( - 'scripts' => array( - 'resources/lib/jquery/jquery.js', - 'resources/lib/jquery/jquery.migrate.js', - ), + 'scripts' => ( $GLOBALS['wgIncludejQueryMigrate'] ? + array( + 'resources/lib/jquery/jquery.js', + 'resources/lib/jquery/jquery.migrate.js' + ) : + array( + 'resources/lib/jquery/jquery.js' + ) ), 'debugRaw' => false, 'targets' => array( 'desktop', 'mobile' ), ), -- 2.20.1