r73058 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73057‎ | r73058 | r73059 >
Date:07:31, 15 September 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Use hook to avoid fatal error
Modified paths:
  • /trunk/extensions/Translate/Translate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/Translate.php
@@ -51,6 +51,7 @@
5252 // Register initialization hook
5353 $wgExtensionFunctions[] = 'efTranslateInit';
5454 $wgHooks['CanonicalNamespaces'][] = 'efTranslateNamespaces';
 55+$wgHooks['ResourceLoaderRegisterModules'][] = 'efTranslateResources';
5556
5657 // Register special pages into MediaWiki
5758 $wgSpecialPages['Translate'] = 'SpecialTranslate';
@@ -404,11 +405,11 @@
405406
406407
407408 # Startup code
408 -
409 -if ( class_exists( 'ResourceLoader' ) ) {
 409+function efTranslateResources() {
410410 ResourceLoader::register( array( 'translate-css' =>
411411 new ResourceLoaderFileModule( array( 'styles' => 'extensions/Translate/Translate.css' ) )
412412 ) );
 413+ return true;
413414 }
414415
415416 function efTranslateNamespaces( &$list ) {

Status & tagging log