Jforrester has uploaded a new change for review.
https://gerrit.wikimedia.org/r/277475
Change subject: [WIP] Drop deprecated $wgIncludeLegacyJavaScript and
$wgPreloadJavaScriptMwUtil
......................................................................
[WIP] Drop deprecated $wgIncludeLegacyJavaScript and $wgPreloadJavaScriptMwUtil
These were deprecated in 0ac4f99804, released as part of MediaWiki 1.26. Any
code that still needs the mediawiki.legacy.wikibits or mediawiki.util modules
can continue to use them whilst expressing this dependency through their
ResourceLoader manifest in the usual way.
Bug: T111077
Change-Id: Ia07b3b95f0444dce35e89e730b2c55d20c09ea68
---
M RELEASE-NOTES-1.27
M includes/DefaultSettings.php
M includes/resourceloader/ResourceLoaderStartUpModule.php
M includes/skins/Skin.php
M resources/src/mediawiki/mediawiki.js
5 files changed, 26 insertions(+), 73 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/75/277475/1
diff --git a/RELEASE-NOTES-1.27 b/RELEASE-NOTES-1.27
index d8866ad..6b2efa9 100644
--- a/RELEASE-NOTES-1.27
+++ b/RELEASE-NOTES-1.27
@@ -98,6 +98,10 @@
* $wgEnotifUseJobQ was removed and the job queue is always used.
* The functionality of the ApiSandbox extension has been merged into core. The
extension should no longer be used.
+* $wgIncludeLegacyJavaScript and $wgPreloadJavaScriptMwUtil were removed. They
+ were deprecated in MediaWiki 1.26. Extensions, skins, gadgets and scripts
+ that need the mediawiki.legacy.wikibits or mediawiki.util modules should
+ express a dependency on them in the usual way.
=== New features in 1.27 ===
* $wgDataCenterUpdateStickTTL was also added. This decides how long a user
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index c04602c..98ed38a 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -3568,31 +3568,6 @@
$wgResourceLoaderMinifierMaxLineLength = 1000;
/**
- * Whether to ensure the mediawiki.legacy library is loaded before other
modules.
- *
- * @deprecated since 1.26: Always declare dependencies.
- */
-$wgIncludeLegacyJavaScript = true;
-
-/**
- * Whether to ensure the mediawiki.util is loaded before other modules.
- *
- * Before MediaWiki 1.19, modules used to load less asynchronous which allowed
- * modules to lack dependencies on 'popular' modules that were likely loaded
already.
- *
- * This setting is to aid scripts during migration by providing mediawiki.util
- * unconditionally (which was the most commonly missed dependency). It doesn't
- * cover all missing dependencies obviously but should fix most of them.
- *
- * This should be removed at some point after site/user scripts have been
fixed.
- * Enable this if your wiki has a large amount of user/site scripts that are
- * lacking dependencies.
- *
- * @deprecated since 1.26: Always declare dependencies.
- */
-$wgPreloadJavaScriptMwUtil = false;
-
-/**
* Whether or not to assign configuration variables to the global window
object.
*
* If this is set to false, old code using deprecated variables will no longer
diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php
b/includes/resourceloader/ResourceLoaderStartUpModule.php
index 6a40e27..c5f9653 100644
--- a/includes/resourceloader/ResourceLoaderStartUpModule.php
+++ b/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -101,7 +101,6 @@
'wgLegalTitleChars' =>
Title::convertByteClassToUnicodeClass( Title::legalChars() ),
'wgResourceLoaderStorageVersion' => $conf->get(
'ResourceLoaderStorageVersion' ),
'wgResourceLoaderStorageEnabled' => $conf->get(
'ResourceLoaderStorageEnabled' ),
- 'wgResourceLoaderLegacyModules' =>
self::getLegacyModules(),
'wgForeignUploadTargets' => $conf->get(
'ForeignUploadTargets' ),
'wgEnableUploads' => $conf->get( 'EnableUploads' ),
];
@@ -276,20 +275,6 @@
*/
public static function getStartupModules() {
return [ 'jquery', 'mediawiki' ];
- }
-
- public static function getLegacyModules() {
- global $wgIncludeLegacyJavaScript, $wgPreloadJavaScriptMwUtil;
-
- $legacyModules = [];
- if ( $wgIncludeLegacyJavaScript ) {
- $legacyModules[] = 'mediawiki.legacy.wikibits';
- }
- if ( $wgPreloadJavaScriptMwUtil ) {
- $legacyModules[] = 'mediawiki.util';
- }
-
- return $legacyModules;
}
/**
diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php
index b80788b..f5cc912 100644
--- a/includes/skins/Skin.php
+++ b/includes/skins/Skin.php
@@ -189,8 +189,6 @@
'content' => [
'mediawiki.page.ready',
],
- // modules that exist for legacy reasons
- 'legacy' =>
ResourceLoaderStartUpModule::getLegacyModules(),
// modules relating to search functionality
'search' => [],
// modules relating to functionality relating to
watching an article
diff --git a/resources/src/mediawiki/mediawiki.js
b/resources/src/mediawiki/mediawiki.js
index 9d799db..7bfb004 100644
--- a/resources/src/mediawiki/mediawiki.js
+++ b/resources/src/mediawiki/mediawiki.js
@@ -1250,10 +1250,7 @@
registry[ module ].state = 'executing';
runScript = function () {
- var script, markModuleReady,
nestedAddScript, legacyWait,
- // Expand to include
dependencies since we have to exclude both legacy modules
- // and their dependencies from
the legacyWait (to prevent a circular dependency).
- legacyModules = resolve(
mw.config.get( 'wgResourceLoaderLegacyModules', [] ) );
+ var script, markModuleReady,
nestedAddScript;
try {
script = registry[ module
].script;
markModuleReady = function () {
@@ -1274,39 +1271,33 @@
} );
};
- legacyWait = ( $.inArray(
module, legacyModules ) !== -1 )
- ? $.Deferred().resolve()
- : mw.loader.using(
legacyModules );
+ if ( $.isArray( script ) ) {
+ nestedAddScript(
script, markModuleReady, 0 );
+ } else if ( $.isFunction(
script ) ) {
+ // Pass jQuery twice so
that the signature of the closure which wraps
+ // the script can bind
both '$' and 'jQuery'.
+ script( $, $,
mw.loader.require, registry[ module ].module );
+ markModuleReady();
- legacyWait.always( function () {
- if ( $.isArray( script
) ) {
-
nestedAddScript( script, markModuleReady, 0 );
- } else if (
$.isFunction( script ) ) {
- // Pass jQuery
twice so that the signature of the closure which wraps
- // the script
can bind both '$' and 'jQuery'.
- script( $, $,
mw.loader.require, registry[ module ].module );
-
markModuleReady();
-
- } else if ( typeof
script === 'string' ) {
- // Site and
user modules are legacy scripts that run in the global scope.
- // This is
transported as a string instead of a function to avoid needing
- // to use
string manipulation to undo the function wrapper.
- if ( module ===
'user' ) {
- //
Implicit dependency on the site module. Not real dependency because
- // it
should run after 'site' regardless of whether it succeeds or fails.
-
mw.loader.using( 'site' ).always( function () {
-
$.globalEval( script );
-
markModuleReady();
- } );
- } else {
+ } else if ( typeof script ===
'string' ) {
+ // Site and user
modules are legacy scripts that run in the global scope.
+ // This is transported
as a string instead of a function to avoid needing
+ // to use string
manipulation to undo the function wrapper.
+ if ( module === 'user'
) {
+ // Implicit
dependency on the site module. Not real dependency because
+ // it should
run after 'site' regardless of whether it succeeds or fails.
+
mw.loader.using( 'site' ).always( function () {
$.globalEval( script );
markModuleReady();
- }
+ } );
} else {
- // Module
without script
+ $.globalEval(
script );
markModuleReady();
}
- } );
+ } else {
+ // Module without script
+ markModuleReady();
+ }
} catch ( e ) {
// This needs to NOT use mw.log
because these errors are common in production mode
// and not in debug mode, such
as when a symbol that should be global isn't exported
--
To view, visit https://gerrit.wikimedia.org/r/277475
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia07b3b95f0444dce35e89e730b2c55d20c09ea68
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits