r62853 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62852‎ | r62853 | r62854 >
Date:22:23, 22 February 2010
Author:demon
Status:ok
Tags:
Comment:
Cleanup to initialization to Storyboard:
* Only use one call to ParserFirstCallInit, drop ancient 1.12 and below compat
* Take $wgExtensionCredits out of $wgExtensionFunctions, not needed
* Group class loading, hooks, etc all together
Modified paths:
  • /trunk/extensions/Storyboard/Storyboard.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/Storyboard.php
@@ -33,33 +33,21 @@
3434 // Include the settings file.
3535 require_once( $egStoryboardDir . 'Storyboard_Settings.php' );
3636
37 -// Register the initialization function of Storyboard.
38 -$wgExtensionFunctions[] = 'efStoryboardSetup';
 37+// Load classes
 38+$wgAutoloadClasses['SpecialStoryReview'] = $egStoryboardDir . 'specials/StoryReview/StoryReview_body.php';
 39+$wgAutoloadClasses['TagStoryboard'] = $egStoryboardDir . 'tags/Storyboard/Storyboard_body.php';
 40+$wgAutoloadClasses['TagStorysubmission'] = $egStoryboardDir . 'tags/Storysubmission/Storysubmission_body.php';
3941
4042 // Register the initernationalization and aliasing files of Storyboard.
4143 $wgExtensionMessagesFiles['Storyboard'] = $egStoryboardDir . 'Storyboard.i18n.php';
4244 $wgExtensionAliasesFiles['Storyboard'] = $egStoryboardDir . 'Storyboard.alias.php';
4345
4446 // Load and register the StoryReview special page and register it's group.
45 -$wgAutoloadClasses['SpecialStoryReview'] = $egStoryboardDir . 'specials/StoryReview/StoryReview_body.php';
4647 $wgSpecialPages['StoryReview'] = 'SpecialStoryReview';
4748 $wgSpecialPageGroups['StoryReview'] = 'contribution';
4849
49 -// Load the tag extension classes.
50 -$wgAutoloadClasses['TagStoryboard'] = $egStoryboardDir . 'tags/Storyboard/Storyboard_body.php';
51 -$wgAutoloadClasses['TagStorysubmission'] = $egStoryboardDir . 'tags/Storysubmission/Storysubmission_body.php';
52 -
53 -// Register the tag extensions.
54 -// Avoid unstubbing $wgParser on setHook() too early on modern (1.12+) MW versions, as per r35980.
55 -if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
56 - $wgHooks['ParserFirstCallInit'][] = 'efStoryboardStoryboardSetup';
57 - $wgHooks['ParserFirstCallInit'][] = 'efStoryboardStorysubmissionSetup';
58 -} else { // Otherwise do things the old fashioned way.
59 - $wgExtensionFunctions[] = 'efStoryboardStoryboardSetup';
60 - $wgExtensionFunctions[] = 'efStoryboardStorysubmissionSetup';
61 -}
62 -
63 -// Hook for db updates.
 50+// Hooks
 51+$wgHooks['ParserFirstCallInit'][] = 'efStoryboardParserFirstCallInit';
6452 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efStoryboardSchemaUpdate';
6553
6654 /**
@@ -71,25 +59,16 @@
7260 $wgAvailableRights[] = 'storyreview';
7361 $wgGroupPermissions['sysop' ]['storyreview'] = true;
7462
75 -/**
76 - * Initialization function for the Storyboard extension.
77 - */
78 -function efStoryboardSetup() {
79 - global $wgExtensionCredits;
 63+$wgExtensionCredits['parserhook'][] = array(
 64+ 'path' => __FILE__,
 65+ 'name' => wfMsg( 'storyboard-name' ),
 66+ 'version' => Storyboard_VERSION,
 67+ 'author' => array( '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]' ),
 68+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Storyboard',
 69+ 'description' => wfMsg( 'storyboard-desc' ),
 70+ 'descriptionmsg' => 'storyboard-desc',
 71+);
8072
81 - wfLoadExtensionMessages( 'Storyboard' );
82 -
83 - $wgExtensionCredits['parserhook'][] = array(
84 - 'path' => __FILE__,
85 - 'name' => wfMsg( 'storyboard-name' ),
86 - 'version' => Storyboard_VERSION,
87 - 'author' => array( '[http://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]' ),
88 - 'url' => 'http://www.mediawiki.org/wiki/Extension:Storyboard',
89 - 'description' => wfMsg( 'storyboard-desc' ),
90 - 'descriptionmsg' => 'storyboard-desc',
91 - );
92 -}
93 -
9473 function efStoryboardSchemaUpdate() {
9574 global $wgExtNewTables, $egStoryboardDir;
9675
@@ -101,14 +80,8 @@
10281 return true;
10382 }
10483
105 -function efStoryboardStoryboardSetup() {
106 - global $wgParser;
107 - $wgParser->setHook( 'storyboard', array('TagStoryboard', 'render') );
 84+function efStoryboardParserFirstCallInit( &$parser ) {
 85+ $parser->setHook( 'storyboard', array('TagStoryboard', 'render') );
 86+ $parser->setHook( 'storysubmission', array('TagStorysubmission', 'render') );
10887 return true;
10988 }
110 -
111 -function efStoryboardStorysubmissionSetup() {
112 - global $wgParser;
113 - $wgParser->setHook( 'storysubmission', array('TagStorysubmission', 'render') );
114 - return true;
115 -}

Follow-up revisions

RevisionCommit summaryAuthorDate
r62855Fix r62853, can't use wfMsg() there, just copy English description like all o...demon22:37, 22 February 2010

Status & tagging log