r97164 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97163‎ | r97164 | r97165 >
Date:15:51, 15 September 2011
Author:catrope
Status:ok (Comments)
Tags:
Comment:
RL2: Followup r97154, rename gadgetManagerConf to gadgetConf and add the repo information required by ext.gadgetmanager.api
Modified paths:
  • /branches/RL2/extensions/Gadgets/GadgetHooks.php (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/GadgetHooks.php
@@ -318,12 +318,26 @@
319319 * @param $out OutputPage
320320 */
321321 public static function makeGlobalVariablesScript( &$vars, $out ) {
322 - if ( $out->getTitle()->equals( SpecialPage::getTitleFor( 'GadgetManager' ) ) ) {
 322+ $title = $out->getTitle();
 323+ // FIXME: This is not a nice way to do it. Maybe we should check for the presence
 324+ // of a module instead or something.
 325+ if ( $title->equals( SpecialPage::getTitleFor( 'GadgetManager' ) ) ||
 326+ $title->equals( SpecialPage::getTitleFor( 'Preferences' ) ) )
 327+ {
323328 global $wgGadgetEnableSharing;
 329+
 330+ // Pass the source data for each source that is used by a repository
 331+ $repos = GadgetRepo::getAllRepos();
 332+ $sources = $out->getResourceLoader()->getSources();
 333+ $repoData = array();
 334+ foreach ( $repos as $repo ) {
 335+ $repoData[$repo->getSource()] = $sources[$repo->getSource()];
 336+ }
324337
325 - $vars['gadgetManagerConf'] = array(
 338+ $vars['gadgetsConf'] = array(
326339 'enableSharing' => $wgGadgetEnableSharing,
327340 'allRights' => User::getAllRights(),
 341+ 'repos' => $repoData
328342 );
329343 }
330344 return true;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97154RL2: Rewrite of ext.gadgets.api that Timo and I worked on together at http://......catrope14:17, 15 September 2011

Comments

#Comment by Krinkle (talk | contribs)   01:57, 17 September 2011
+		// FIXME: This is not a nice way to do it. Maybe we should check for the presence
+		// of a module instead or something.

Or better, we shouldn't have to poke in makeGlobalVariablesScript (that name, albeit the "global" pat is outdated, says it clearly). These aren't global or site-wide config vars. They module-specific configs.

See also bug 26901, which requests a feature (perhaps for RL3) to allow setting a 'config' key in the ResourceLoaderModule which then becomes available (if the module is loaded) as mw.loader.getOptions( 'modulename' /*or some other symbolic name*/ );

Status & tagging log