r60298 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60297‎ | r60298 | r60299 >
Date:22:43, 22 December 2009
Author:catrope
Status:ok
Tags:
Comment:
UsabilityInitiative: Fix loading order issues by adding a UsabilityInitiativeLoadModules hook. WikiEditor still uses the EditPageBeforeEditToolbar hook, which may be undesirable for multiple reasons, but I left that alone for now.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/Vector/Vector.php
@@ -49,5 +49,5 @@
5050 $wgExtensionMessagesFiles['VectorSimpleSearch'] = dirname( __FILE__ ) . '/Modules/SimpleSearch/SimpleSearch.i18n.php';
5151
5252 // Register Hooks
53 -$wgHooks['BeforePageDisplay'][] = 'VectorHooks::addModules';
 53+$wgHooks['UsabilityInitiativeLoadModules'][] = 'VectorHooks::addModules';
5454 $wgHooks['GetPreferences'][] = 'VectorHooks::addPreferences';
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php
@@ -61,14 +61,15 @@
6262 */
6363
6464 /**
65 - * BeforePageDislay hook
 65+ * BeforePageDisplay hook
6666 * Adds the modules to the edit form
6767 */
68 - public static function addModules( &$out, &$sk ) {
69 - global $wgUser, $wgJsMimeType;
 68+ public static function addModules() {
 69+ global $wgUser, $wgJsMimeType, $wgOut;
7070 global $wgVectorModules, $wgUsabilityInitiativeResourceMode;
7171
7272 // Modules
 73+ UsabilityInitiativeHooks::initialize();
7374 $preferences = array();
7475 foreach ( $wgVectorModules as $module => $enable ) {
7576 if (
@@ -78,7 +79,6 @@
7980 && $wgUser->getOption( self::$modules[$module]['preferences']['enable']['key'] )
8081 )
8182 ) {
82 - UsabilityInitiativeHooks::initialize();
8383 // Messages
8484 if ( isset( self::$modules[$module]['i18n'], self::$modules[$module]['messages'] ) ) {
8585 wfLoadExtensionMessages( self::$modules[$module]['i18n'] );
@@ -111,7 +111,7 @@
112112 );
113113 }
114114 // Preferences (maybe the UsabilityInitiative class could do most of this for us?)
115 - $out->addScript(
 115+ $wgOut->addScript(
116116 Xml::tags(
117117 'script',
118118 array( 'type' => $wgJsMimeType ),
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -105,6 +105,8 @@
106106 global $wgEnableJS2system, $wgEditToolbarRunTests;
107107 global $wgStyleVersion;
108108
 109+ wfRunHooks( 'UsabilityInitiativeLoadModules' );
 110+
109111 if ( !self::$doOutput )
110112 return true;
111113

Status & tagging log