From 975db1f6b195a881b5c43585f2cf3ad515e187c4 Mon Sep 17 00:00:00 2001 From: MusikAnimal Date: Fri, 30 Aug 2024 17:47:19 -0400 Subject: [PATCH] ext.CodeMirror.js: emit deprecation warning when using CM5 on CM6 wiki If CodeMirror 6 is enabled and a request is made for ext.CodeMirror (which is a dependency of all CM5 modules), emit a warning. This should only effect scripts and gadgets on the WMF cluster. The CM5 ResourceLoader modules will later be tagged as deprecated after CM6 is rolled out to all WMF wikis. Bug: T373720 Change-Id: Ia25e896b80766b5b16b9b69343f24557007b5570 --- resources/legacy/ext.CodeMirror.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resources/legacy/ext.CodeMirror.js b/resources/legacy/ext.CodeMirror.js index 91a3879b..2da5a4aa 100644 --- a/resources/legacy/ext.CodeMirror.js +++ b/resources/legacy/ext.CodeMirror.js @@ -1,5 +1,14 @@ require( './ext.CodeMirror.data.js' ); +if ( mw.config.get( 'extCodeMirrorConfig' ).useV6 ) { + const deprecationFn = mw.log.makeDeprecated( + 'CodeMirror5-deprecation', + 'CodeMirror 5 has been deprecated in MediaWiki 1.43 and will be removed in 1.44. ' + + 'Please migrate to CodeMirror 6. See https://w.wiki/B3pr for more information.' + ); + deprecationFn(); +} + /** * Log usage of CodeMirror. *