jenkins-bot has submitted this change and it was merged.

Change subject: Clean up RL module definitions.
......................................................................


Clean up RL module definitions.

* Remove unneeded addModuleStyles(), it's redundant with addModule().
* Replace two array dependencies with their single contents.
* Use __DIR__ instead of dirname.
* Use + for concatenate $baseExtensionResource instead of array_merge().
* Improve a hook comment.

Related to bug 55550 though this doesn't reduce amount of JS code loaded.

I couldn't get TMH to work on my wiki, so this is untested, but the modules
load without errors in 1.22.
TimedMediaHandler claims to work with MediaWiki 1.17, so some of these may
be intentional for backwards compatibility and the cleanup unwanted.

Change-Id: Ia7b465c2db154620585db481db88a4c88a002038
---
M TimedMediaHandler.hooks.php
M TimedMediaHandler_body.php
2 files changed, 17 insertions(+), 19 deletions(-)

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



diff --git a/TimedMediaHandler.hooks.php b/TimedMediaHandler.hooks.php
index b43f1ce..2fac670 100644
--- a/TimedMediaHandler.hooks.php
+++ b/TimedMediaHandler.hooks.php
@@ -50,26 +50,26 @@
                $wgJobTypesExcludedFromDefaultQueue[] = 'webVideoTranscode';
 
                $baseExtensionResource = array(
-                       'localBasePath' => dirname( __FILE__ ),
+                       'localBasePath' => __DIR__,
                        'remoteExtPath' => 'TimedMediaHandler',
                );
 
                // Add the PopUpMediaTransform module ( specific to timedMedia 
handler ( no support in mwEmbed modules )
                $wgResourceModules+= array(
-                       'mw.PopUpMediaTransform' => array_merge( 
$baseExtensionResource, array(
+                       'mw.PopUpMediaTransform' => $baseExtensionResource + 
array(
                                'scripts' => 'resources/mw.PopUpThumbVideo.js',
                                'styles' => 'resources/PopUpThumbVideo.css',
                                'dependencies' => array( 'mw.MwEmbedSupport', 
'mediawiki.Title' ),
-                       ) ),
-                       'mw.TMHGalleryHook.js' => array_merge( 
$baseExtensionResource, array(
+                       ),
+                       'mw.TMHGalleryHook.js' => $baseExtensionResource + 
array(
                                'scripts' => 'resources/mw.TMHGalleryHook.js',
                                // position top needed as it needs to load 
before mediawiki.page.gallery
                                'position' => 'top',
-                       ) ),
-                       'embedPlayerIframeStyle'=> array_merge( 
$baseExtensionResource, array(
+                       ),
+                       'embedPlayerIframeStyle'=> $baseExtensionResource + 
array(
                                'styles' => 'resources/embedPlayerIframe.css',
-                       ) ),
-                       'ext.tmh.transcodetable' => array_merge( 
$baseExtensionResource, array(
+                       ),
+                       'ext.tmh.transcodetable' => $baseExtensionResource + 
array(
                                'scripts' => 
'resources/ext.tmh.transcodetable.js',
                                'styles' => 'resources/transcodeTable.css',
                                'messages'=> array(
@@ -79,15 +79,15 @@
                                        'timedmedia-reset',
                                        'timedmedia-reset-confirm'
                                )
-                       ) ),
-                       "mw.MediaWikiPlayerSupport" =>  array_merge( 
$baseExtensionResource, array(
+                       ),
+                       "mw.MediaWikiPlayerSupport" =>  $baseExtensionResource 
+ array(
                                'scripts' => 
'resources/mw.MediaWikiPlayerSupport.js',
-                               'dependencies'=> array( 'mw.Api' )
-                       ) ),
+                               'dependencies'=> 'mw.Api',
+                       ),
                        // adds support MediaWikiPlayerSupport player bindings
-                       "mw.MediaWikiPlayer.loader" =>  array_merge( 
$baseExtensionResource, array(
+                       "mw.MediaWikiPlayer.loader" =>  $baseExtensionResource 
+ array(
                                'loaderScripts' => 
'resources/mw.MediaWikiPlayer.loader.js',
-                       ) ),
+                       ),
                );
                // Setup a hook for iframe embed handling:
                $wgHooks['ArticleFromTitle'][] = 
'TimedMediaIframeOutput::iframeHook';
@@ -318,7 +318,7 @@
         * @return bool
         */
        public static function loadExtensionSchemaUpdates( $updater ){
-               $updater->addExtensionTable( 'transcode', dirname( __FILE__ ) . 
'/TimedMediaHandler.sql' );
+               $updater->addExtensionTable( 'transcode', __DIR__ . 
'/TimedMediaHandler.sql' );
                return true;
        }
 
@@ -328,7 +328,7 @@
         * @return bool
         */
        public static function registerUnitTests( array &$files ) {
-               $testDir = dirname( __FILE__ ) . '/tests/phpunit/';
+               $testDir = __DIR__ . '/tests/phpunit/';
                $testFiles = array(
                        'TestTimeParsing.php',
                        'TestApiUploadVideo.php',
@@ -348,7 +348,6 @@
         */
        static function pageOutputHook(  &$out, &$sk ){
                $out->addModules( 'mw.PopUpMediaTransform' );
-               $out->addModuleStyles( 'mw.PopUpMediaTransform' );
                return true;
        }
 
diff --git a/TimedMediaHandler_body.php b/TimedMediaHandler_body.php
index 50e1de6..e203ff9 100644
--- a/TimedMediaHandler_body.php
+++ b/TimedMediaHandler_body.php
@@ -182,7 +182,7 @@
        }
 
        /**
-        * Output hook only adds the PopUpMediaTransform
+        * Parser output hook only adds the PopUpMediaTransform
         *
         * The core embedPlayer module is part of a "loaderScript" so it does 
not need to
         * be registered here.
@@ -196,7 +196,6 @@
        static function outputHook( $outputPage, $parserOutput, $data ) {
                // Add the PopUpMediaTransform code
                $outputPage->addModules( 'mw.PopUpMediaTransform' );
-               $outputPage->addModuleStyles( 'mw.PopUpMediaTransform' );
                $outputPage->addModules( 'mw.TMHGalleryHook.js' );
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia7b465c2db154620585db481db88a4c88a002038
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Spage <sp...@wikimedia.org>
Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com>
Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: Mdale <md...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to