r90044 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90043‎ | r90044 | r90045 >
Date:13:58, 14 June 2011
Author:werdna
Status:deferred
Tags:
Comment:
MoodBar: Rename resource module, add hooks for adding the resource module and applying schema updates
Modified paths:
  • /trunk/extensions/MoodBar/Hooks.php (added) (history)
  • /trunk/extensions/MoodBar/MoodBar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/Hooks.php
@@ -0,0 +1,31 @@
 2+<?php
 3+
 4+class MoodBarHooks {
 5+ /**
 6+ * Adds MoodBar JS to the output if appropriate.
 7+ */
 8+ public static function onPageDisplay( &$output, &$skin ) {
 9+ if ( self::shouldShowMoodbar() ) {
 10+ $output->addModules( array('ext.moodbar') );
 11+ }
 12+
 13+ return true;
 14+ }
 15+
 16+ /**
 17+ * Determines whether or not we should show the MoodBar.
 18+ */
 19+ public static function shouldShowMoodbar() {
 20+ return true;
 21+ }
 22+
 23+ /**
 24+ * Runs MoodBar schema updates
 25+ */
 26+ public static function onLoadExtensionSchemaUpdates( $updater = null ) {
 27+ $updater->addExtensionUpdate( array( 'addTable', 'moodbar_feedback',
 28+ dirname(__FILE__).'/moodbar.sql' ) );
 29+
 30+ return true;
 31+ }
 32+}
Index: trunk/extensions/MoodBar/MoodBar.php
@@ -20,6 +20,11 @@
2121 $wgAutoloadClasses['ApiMoodBar'] = dirname(__FILE__).'/ApiMoodBar.php';
2222 $wgAPIModules['moodbar'] = 'ApiMoodBar';
2323
 24+// Hooks
 25+$wgAutoloadClasses['MoodBarHooks'] = dirname(__FILE__).'/Hooks.php';
 26+$wgHooks['BeforePageDisplay'][] = 'MoodBarHooks::onPageDisplay';
 27+$wgHooks['LoadExtensionSchemaUpdates'][] = 'MoodBarHooks::onLoadExtensionSchemaUpdates';
 28+
2429 // Internationalisation
2530 $wgExtensionMessagesFiles = dirname(__FILE__).'/Messages.php';
2631
@@ -29,7 +34,7 @@
3035 'remoteExtPath' => 'MoodBar'
3136 );
3237
33 -$wgResourceModules['ext.moodBar'] = $mbResourceTemplate + array(
 38+$wgResourceModules['ext.moodbar'] = $mbResourceTemplate + array(
3439 'styles' => array( ),
3540 'scripts' => array( ),
3641 'dependencies' => array( ),

Status & tagging log