jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/333580 )

Change subject: Skip registering RL modules depending on VisualEditor
......................................................................


Skip registering RL modules depending on VisualEditor

 When VisualEditor is not installed, there is no point in registering
resource loader modules that depends on it.

A use case is trying to run tests for the MediaWiki tarball. It comes
with SyntaxHighlight_GeSHi but without VisualEditor.

The patch is based on GuidedTour patch by Matthew Flaschen
https://gerrit.wikimedia.org/r/#/c/305691/ for T143297
A similar one has been done for Cite:
https://gerrit.wikimedia.org/r/#/c/316010/

Change-Id: Idf769e0149f93c099a94b1b7a6cb203273dab881
---
M SyntaxHighlight_GeSHi.class.php
M extension.json
2 files changed, 47 insertions(+), 28 deletions(-)

Approvals:
  Hashar: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/SyntaxHighlight_GeSHi.class.php b/SyntaxHighlight_GeSHi.class.php
index 5381351..42ae59a 100644
--- a/SyntaxHighlight_GeSHi.class.php
+++ b/SyntaxHighlight_GeSHi.class.php
@@ -496,6 +496,50 @@
                return true;
        }
 
+       /**
+        * Conditionally register resource loader modules that depends on the
+        * VisualEditor MediaWiki extension.
+        *
+        * @param $resourceLoader
+        * @return true
+        */
+       public static function onResourceLoaderRegisterModules( 
&$resourceLoader ) {
+               if ( ExtensionRegistry::getInstance()->isLoaded( 'VisualEditor' 
) ) {
+                       return;
+               }
+
+               $resourceLoader->register( 'ext.geshi.visualEditor', [
+                       'class' => 'ResourceLoaderGeSHiVisualEditorModule',
+                       'localBasePath' => __DIR__ . DIRECTORY_SEPARATOR . 
'modules',
+                       'remoteExtPath' => 'SyntaxHighlight_GeSHi/modules',
+                       'scripts' => [
+                               
've-syntaxhighlight/ve.dm.MWSyntaxHighlightNode.js',
+                               
've-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js',
+                               
've-syntaxhighlight/ve.ui.MWSyntaxHighlightWindow.js',
+                               
've-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.js',
+                               
've-syntaxhighlight/ve.ui.MWSyntaxHighlightDialogTool.js',
+                               
've-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js',
+                               
've-syntaxhighlight/ve.ui.MWSyntaxHighlightInspectorTool.js',
+                       ],
+                       'styles' => [
+                               
've-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.css',
+                               
've-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.css',
+                               
've-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.css',
+                       ],
+                       'dependencies' => [
+                               'ext.visualEditor.mwcore',
+                       ],
+                       'messages' => [
+                               
'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-code',
+                               
'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-language',
+                               
'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-none',
+                               
'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-showlines',
+                               
'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-title',
+                       ],
+                       'targets' => [ 'desktop', 'mobile' ],
+               ] );
+       }
+
        /** Backward-compatibility shim for extensions.  */
        public static function prepare( $text, $lang ) {
                wfDeprecated( __METHOD__ );
diff --git a/extension.json b/extension.json
index eab0d93..96992be 100644
--- a/extension.json
+++ b/extension.json
@@ -45,34 +45,6 @@
                                "pygments.generated.css",
                                "pygments.wrapper.css"
                        ]
-               },
-               "ext.geshi.visualEditor": {
-                       "class": "ResourceLoaderGeSHiVisualEditorModule",
-                       "scripts": [
-                               
"ve-syntaxhighlight/ve.dm.MWSyntaxHighlightNode.js",
-                               
"ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js",
-                               
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightWindow.js",
-                               
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.js",
-                               
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialogTool.js",
-                               
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js",
-                               
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspectorTool.js"
-                       ],
-                       "styles": [
-                               
"ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.css",
-                               
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.css",
-                               
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.css"
-                       ],
-                       "dependencies": [
-                               "ext.visualEditor.mwcore"
-                       ],
-                       "messages": [
-                               
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-code",
-                               
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-language",
-                               
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-none",
-                               
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-showlines",
-                               
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-title"
-                       ],
-                       "targets": [ "desktop", "mobile" ]
                }
        },
        "Hooks": {
@@ -87,6 +59,9 @@
                ],
                "RejectParserCacheValue": [
                        "SyntaxHighlight_GeSHi::onRejectParserCacheValue"
+               ],
+               "ResourceLoaderRegisterModules": [
+                       "SyntaxHighlight_GeSHi::onResourceLoaderRegisterModules"
                ]
        },
        "SyntaxHighlightModels": {

-- 
To view, visit https://gerrit.wikimedia.org/r/333580
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idf769e0149f93c099a94b1b7a6cb203273dab881
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/SyntaxHighlight_GeSHi
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: Bartosz DziewoƄski <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to