r37641 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37640‎ | r37641 | r37642 >
Date:11:54, 14 July 2008
Author:catrope
Status:old
Tags:
Comment:
Redircite, RandomImage: Actually, let's use ParserFirstCallInit conditionally for backwards compatibility
Modified paths:
  • /trunk/extensions/RandomImage/RandomImage.php (modified) (history)
  • /trunk/extensions/redircite/redircite.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RandomImage/RandomImage.php
@@ -23,7 +23,7 @@
2424 );
2525 $wgExtensionMessagesFiles['RandomImage'] = dirname(__FILE__) . '/RandomImage.i18n.php';
2626 $wgHooks['ParserAfterStrip'][] = 'RandomImage::stripHook';
27 - $wgHooks['ParserFirstCallInit'][] = 'efRandomImage';
 27+ $wgExtensionFunctions[] = 'efRandomImageSetup';
2828
2929 /**
3030 * Set this to true to disable the parser cache for pages which
@@ -41,6 +41,15 @@
4242 /**
4343 * Extension initialisation function
4444 */
 45+ function efRandomImageSetup() {
 46+ if(defined('MW_SUPPORTS_PARSERFIRSTCALLINIT')) {
 47+ global $wgHooks;
 48+ $wgHooks['ParserFirstCallInit'][] = 'efRandomImage';
 49+ } else {
 50+ global $wgParser;
 51+ efRandomImage($wgParser);
 52+ }
 53+ }
4554 function efRandomImage($parser) {
4655 $parser->setHook( 'randomimage', 'RandomImage::renderHook' );
4756 return true;
Index: trunk/extensions/redircite/redircite.php
@@ -24,8 +24,17 @@
2525 'url' => 'http://www.mediawiki.org/wiki/Extension:Redircite'
2626 );
2727
 28+$wgExtensionFunctions[] = 'efRedircite';
2829 $wgHooks['ParserAfterTidy'][] = 'redircite_afterTidy';
29 -$wgHooks['ParserFirstCallInit'][] = 'redircite_setup';
 30+function efRedircite() {
 31+ if(defined('MW_SUPPORTS_PARSERFIRSTCALLINIT')) {
 32+ global $wgHooks;
 33+ $wgHooks['ParserFirstCallInit'][] = 'redircite_setup';
 34+ } else {
 35+ global $wgParser;
 36+ redircite_setup($wgParser);
 37+ }
 38+}
3039 function redircite_setup($parser) {
3140 $parser->setHook('redircite', 'redircite_render');
3241 return true;

Status & tagging log