Index: branches/RL2/extensions/Gadgets/Gadgets.php |
— | — | @@ -83,6 +83,7 @@ |
84 | 84 | $wgHooks['GetPreferences'][] = 'GadgetHooks::getPreferences'; |
85 | 85 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'GadgetHooks::loadExtensionSchemaUpdates'; |
86 | 86 | $wgHooks['ResourceLoaderRegisterModules'][] = 'GadgetHooks::registerModules'; |
| 87 | +$wgHooks['TitleIsCssOrJsPage'][] = 'GadgetHooks::titleIsCssOrJsPage'; |
87 | 88 | $wgHooks['UnitTestsList'][] = 'GadgetHooks::unitTestsList'; |
88 | 89 | |
89 | 90 | $dir = dirname(__FILE__) . '/'; |
Index: branches/RL2/extensions/Gadgets/GadgetHooks.php |
— | — | @@ -92,14 +92,16 @@ |
93 | 93 | * @param $resourceLoader ResourceLoader |
94 | 94 | */ |
95 | 95 | public static function registerModules( &$resourceLoader ) { |
96 | | - $gadgets = Gadget::loadList(); |
97 | | - if ( !$gadgets ) { |
98 | | - return true; |
99 | | - } |
100 | | - foreach ( $gadgets as $g ) { |
101 | | - $module = $g->getModule(); |
102 | | - if ( $module ) { |
103 | | - $resourceLoader->register( $g->getModuleName(), $module ); |
| 96 | + global $wgGadgetRepositories; |
| 97 | + foreach ( $wgGadgetRepositories as $params ) { |
| 98 | + $repoClass = $params['class']; |
| 99 | + unset( $params['class'] ); |
| 100 | + $repo = new $repoClass( $params ); |
| 101 | + |
| 102 | + $gadgets = $repo->getGadgetNames(); |
| 103 | + foreach ( $gadgets as $name ) { |
| 104 | + $gadget = $repo->getGadget( $name ); |
| 105 | + $resourceLoader->register( $gadget->getModuleName(), $gadget->getModule() ); |
104 | 106 | } |
105 | 107 | } |
106 | 108 | return true; |
— | — | @@ -193,4 +195,11 @@ |
194 | 196 | $list[NS_GADGET_TALK] = 'Gadget_talk'; |
195 | 197 | return true; |
196 | 198 | } |
| 199 | + |
| 200 | + public static function titleIsCssOrJsPage( $title, &$result ) { |
| 201 | + if ( $title->getNamespace() == NS_GADGET ) { |
| 202 | + $result = true; |
| 203 | + } |
| 204 | + return true; |
| 205 | + } |
197 | 206 | } |