Spage has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/92052


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, 18 insertions(+), 20 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/52/92052/1

diff --git a/TimedMediaHandler.hooks.php b/TimedMediaHandler.hooks.php
index 0a41b97..b14f32a 100644
--- a/TimedMediaHandler.hooks.php
+++ b/TimedMediaHandler.hooks.php
@@ -51,26 +51,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' ),
-                       ) ),
-                       'mw.TMHGalleryHook.js' => array_merge( 
$baseExtensionResource, array(
+                               'dependencies' => 'mw.MwEmbedSupport',
+                       ),
+                       '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(
@@ -80,15 +80,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';
@@ -319,7 +319,7 @@
         * @return bool
         */
        public static function loadExtensionSchemaUpdates( $updater ){
-               $updater->addExtensionTable( 'transcode', dirname( __FILE__ ) . 
'/TimedMediaHandler.sql' );
+               $updater->addExtensionTable( 'transcode', __DIR__ . 
'/TimedMediaHandler.sql' );
                return true;
        }
 
@@ -329,7 +329,7 @@
         * @return bool
         */
        public static function registerUnitTests( array &$files ) {
-               $testDir = dirname( __FILE__ ) . '/tests/phpunit/';
+               $testDir = __DIR__ . '/tests/phpunit/';
                $testFiles = array(
                        'TestTimeParsing.php',
                        'TestApiUploadVideo.php',
@@ -349,7 +349,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: newchange
Gerrit-Change-Id: Ia7b465c2db154620585db481db88a4c88a002038
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Spage <[email protected]>

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

Reply via email to