r89246 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89245‎ | r89246 | r89247 >
Date:01:10, 1 June 2011
Author:dale
Status:deferred
Tags:
Comment:
bug 29177 moved MwEmbedResourceManager::register calls into SetupAfterCache hook
Modified paths:
  • /trunk/extensions/MwEmbedSupport/MwEmbedSupport.hooks.php (added) (history)
  • /trunk/extensions/MwEmbedSupport/MwEmbedSupport.php (modified) (history)
  • /trunk/extensions/TimedMediaHandler/TimedMediaHandler.hooks.php (modified) (history)
  • /trunk/extensions/TimedMediaHandler/TimedMediaHandler.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler.php
@@ -118,10 +118,6 @@
119119 $wgAutoloadClasses['WebVideoTranscodeJob'] = "$timedMediaDir/WebVideoTranscode/WebVideoTranscodeJob.php";
120120 $wgAutoloadClasses['ApiQueryVideoInfo'] = "$timedMediaDir/ApiQueryVideoInfo.php";
121121
122 -// Register the Timed Media Handler javascript resources ( MwEmbed modules )
123 -MwEmbedResourceManager::register( 'extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer' );
124 -MwEmbedResourceManager::register( 'extensions/TimedMediaHandler/MwEmbedModules/TimedText' );
125 -
126122 // Localization
127123 $wgExtensionMessagesFiles['TimedMediaHandler'] = "$timedMediaDir/TimedMediaHandler.i18n.php";
128124 $wgExtensionMessagesFiles['TimedMediaHandlerMagic'] = "$timedMediaDir/TimedMediaHandler.i18n.magic.php";
Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler.hooks.php
@@ -13,7 +13,11 @@
1414 global $wgParserOutputHooks, $wgHooks, $wgJobClasses, $wgJobTypesExcludedFromDefaultQueue,
1515 $wgMediaHandlers, $wgResourceModules, $wgExcludeFromThumbnailPurge, $wgExtraNamespaces,
1616 $tmhFileExtensions, $wgParserOutputHooks, $wgOut, $wgAPIPropModules, $wgTimedTextNS;
17 -
 17+
 18+ // Register the Timed Media Handler javascript resources ( MwEmbed modules )
 19+ MwEmbedResourceManager::register( 'extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer' );
 20+ MwEmbedResourceManager::register( 'extensions/TimedMediaHandler/MwEmbedModules/TimedText' );
 21+
1822 // Setup media Handlers:
1923 $wgMediaHandlers['application/ogg'] = 'OggHandler';
2024 $wgMediaHandlers['video/webm'] = 'WebMHandler';
@@ -28,6 +32,7 @@
2933 $wgJobClasses+= array(
3034 'webVideoTranscode' => 'WebVideoTranscodeJob'
3135 );
 36+
3237 // Transcode jobs must be explicitly requested from the job queue:
3338 $wgJobTypesExcludedFromDefaultQueue[] = 'webVideoTranscode';
3439
Index: trunk/extensions/MwEmbedSupport/MwEmbedSupport.php
@@ -33,33 +33,8 @@
3434 );
3535
3636 $wgAutoloadClasses['MwEmbedResourceManager'] = dirname( __FILE__ ) . '/MwEmbedResourceManager.php';
 37+$wgAutoloadClasses['MwEmbedSupportHooks'] = dirname( __FILE__ ) . '/MwEmbedSupport.hooks.php';
3738
38 -// Add Global MwEmbed Registration hook
39 -$wgHooks['ResourceLoaderRegisterModules'][] = 'MwEmbedResourceManager::registerModules';
40 -
41 -// Add MwEmbed module configuration
42 -$wgHooks['ResourceLoaderGetConfigVars'][] = 'MwEmbedResourceManager::registerConfigVars';
43 -
4439 /* MwEmbed Module Registration */
45 -
46 -// Register the core MwEmbed Support Module:
47 -MwEmbedResourceManager::register( 'extensions/MwEmbedSupport/MwEmbedModules/MwEmbedSupport' );
48 -
49 -// Register the MwEmbed 'mediaWiki' Module:
50 -MwEmbedResourceManager::register( 'extensions/MwEmbedSupport/MwEmbedModules/MediaWikiSupport' );
51 -
52 -// Add MwEmbedSupport to Startup:
53 -function MwUpdateStartupModules( &$modules ){
54 - array_push($modules, 'jquery.triggerQueueCallback', 'jquery.mwEmbedUtil', 'mw.MwEmbedSupport' );
55 - return true;
56 -}
57 -$wgHooks['ResourceLoaderGetStartupModules'][] = 'MwUpdateStartupModules';
58 -
59 -
60 -
61 -// Add mwEmbed Support ( style sheets and messages post page ready )
62 -$wgHooks['BeforePageDisplay'][] = 'MwUpdatePageModules';
63 -function MwUpdatePageModules( &$out ){
64 - $out->addModules( 'mw.MwEmbedSupport.style' );
65 - return true;
66 -}
\ No newline at end of file
 40+$wgHooks['SetupAfterCache'][] = 'MwEmbedSupportHooks::register';
 41+
Index: trunk/extensions/MwEmbedSupport/MwEmbedSupport.hooks.php
@@ -0,0 +1,49 @@
 2+<?php
 3+
 4+/**
 5+ * Hooks for MwEmbedSupport extension
 6+ *
 7+ * @file
 8+ * @ingroup Extensions
 9+ */
 10+
 11+class MwEmbedSupportHooks {
 12+ // Register MwEmbedSupport Hooks
 13+ static function register(){
 14+ global $wgHooks;
 15+ // Register the core MwEmbed Support Module:
 16+ MwEmbedResourceManager::register( 'extensions/MwEmbedSupport/MwEmbedModules/MwEmbedSupport' );
 17+
 18+ // Register the MwEmbed 'mediaWiki' Module:
 19+ MwEmbedResourceManager::register( 'extensions/MwEmbedSupport/MwEmbedModules/MediaWikiSupport' );
 20+
 21+ // Add mwEmbed Support modules that are not part of startup
 22+ $wgHooks['BeforePageDisplay'][] = 'MwEmbedSupportHooks::UpdatePageModules';
 23+
 24+ // Add Global MwEmbed Registration hook
 25+ $wgHooks['ResourceLoaderRegisterModules'][] = 'MwEmbedResourceManager::registerModules';
 26+
 27+ // Add MwEmbed module configuration
 28+ $wgHooks['ResourceLoaderGetConfigVars'][] = 'MwEmbedResourceManager::registerConfigVars';
 29+
 30+ // Add the startup modules hook
 31+ $wgHooks['ResourceLoaderGetStartupModules'][] = 'MwEmbedSupportHooks::addStartupModules';
 32+ return true;
 33+ }
 34+
 35+ /**
 36+ * Update the page modules to include mwEmbed style
 37+ *
 38+ * TODO look into loading this on-demand instead of all pages.
 39+ */
 40+ static function updatePageModules( &$out ){
 41+ $out->addModules( 'mw.MwEmbedSupport.style' );
 42+ return true;
 43+ }
 44+
 45+ // Add MwEmbedSupport modules to Startup:
 46+ static function addStartupModules( &$modules ){
 47+ array_push($modules, 'jquery.triggerQueueCallback', 'jquery.mwEmbedUtil', 'mw.MwEmbedSupport' );
 48+ return true;
 49+ }
 50+}
\ No newline at end of file

Status & tagging log