r102645 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102644‎ | r102645 | r102646 >
Date:12:27, 10 November 2011
Author:nikerabbit
Status:ok (Comments)
Tags:
Comment:
Document the hooks, added a fixme for one hook that should not depend on user
Modified paths:
  • /trunk/extensions/Narayam/Narayam.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Narayam/Narayam.hooks.php
@@ -6,6 +6,8 @@
77 */
88
99 class NarayamHooks {
 10+
 11+ /// Hook: BeforePageDisplay
1012 public static function addModules( $out, $skin ) {
1113 global $wgUser;
1214
@@ -24,9 +26,11 @@
2527 return true;
2628 }
2729
 30+ /// Hook: ResourceLoaderGetConfigVars
2831 public static function addConfig( &$vars ) {
2932 global $wgNarayamEnabledByDefault, $wgNarayamRecentItemsLength, $wgUser;
3033
 34+ // FIXME: this hook cannot depend on any state!
3135 if ( $wgUser->getOption( 'narayamDisable' ) ) {
3236 // User disabled Narayam
3337 return true;
@@ -34,10 +38,11 @@
3539
3640 $vars['wgNarayamEnabledByDefault'] = $wgNarayamEnabledByDefault;
3741 $vars['wgNarayamRecentItemsLength'] = $wgNarayamRecentItemsLength;
38 -
 42+
3943 return true;
4044 }
4145
 46+ /// Hook: MakeGlobalVariablesScript
4247 public static function addVariables( &$vars ) {
4348 global $wgUser, $wgNarayamSchemes;
4449
@@ -64,12 +69,13 @@
6570 $wgNarayamSchemes[$wgLanguageCode] : array();
6671 $userlangSchemes = isset( $wgNarayamSchemes[$userlangCode] ) ?
6772 $wgNarayamSchemes[$userlangCode] : array();
68 -
 73+
6974 $schemes = $userlangSchemes + $contlangSchemes;
7075
7176 return $schemes;
7277 }
7378
 79+ /// Hook: GetPreferences
7480 public static function addPreference( $user, &$preferences ) {
7581 // A checkbox in preferences to diable Narayam
7682 $preferences['narayamDisable'] = array(

Comments

#Comment by Santhosh.thottingal (talk | contribs)   10:34, 11 November 2011

Why three slashes instead of normal method comment convention?

#Comment by Nikerabbit (talk | contribs)   10:37, 11 November 2011

I see no need to use three lines to say what hook it is when one line sufficies. /// is another way to tell documentation generators that it is function documentation and not just normal comment.

Status & tagging log