r78123 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78122‎ | r78123 | r78124 >
Date:11:57, 9 December 2010
Author:siebrand
Status:ok (Comments)
Tags:
Comment:
Follow-up r78122: Remove wfLoadExtensionMessages from selected extensions (those run on translatewiki.net).
* special handling for Maps and Validator: check MediaWiki version and if 1.15 of lower, call wfLoadExtensionMessages.
Modified paths:
  • /trunk/extensions/APC/SpecialAPC.php (modified) (history)
  • /trunk/extensions/Babel/Babel.class.php (modified) (history)
  • /trunk/extensions/Babel/BabelAutoCreate.class.php (modified) (history)
  • /trunk/extensions/CleanChanges/CleanChanges_body.php (modified) (history)
  • /trunk/extensions/CleanChanges/Filters.php (modified) (history)
  • /trunk/extensions/DeleteBatch/DeleteBatch.body.php (modified) (history)
  • /trunk/extensions/GoogleAdSense/GoogleAdSense.class.php (modified) (history)
  • /trunk/extensions/I18nTags/I18nTags.php (modified) (history)
  • /trunk/extensions/Interwiki/Interwiki_body.php (modified) (history)
  • /trunk/extensions/LanguageSelector/LanguageSelector.php (modified) (history)
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/ReplaceText/SpecialReplaceText.php (modified) (history)
  • /trunk/extensions/UserMerge/UserMerge_body.php (modified) (history)
  • /trunk/extensions/Validator/Validator.php (modified) (history)
  • /trunk/extensions/WebChat/WebChat_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DeleteBatch/DeleteBatch.body.php
@@ -1,7 +1,6 @@
22 <?php
33
44 class DeleteBatch extends SpecialPage {
5 -
65 /**
76 * Constructor
87 */
@@ -35,8 +34,6 @@
3635 return;
3736 }
3837
39 - wfLoadExtensionMessages( 'DeleteBatch' );
40 -
4138 $wgOut->setPageTitle( wfMsg( 'deletebatch-title' ) );
4239 $cSF = new DeleteBatchForm( $par, $this->getTitle() );
4340
Index: trunk/extensions/Interwiki/Interwiki_body.php
@@ -4,7 +4,6 @@
55 * @ingroup SpecialPage
66 */
77 class SpecialInterwiki extends SpecialPage {
8 -
98 /**
109 * Constructor - sets up the new special page
1110 */
@@ -27,8 +26,6 @@
2827 public function execute( $par ) {
2928 global $wgRequest, $wgOut, $wgUser;
3029
31 - wfLoadExtensionMessages( 'Interwiki' );
32 -
3330 $admin = $wgUser->isAllowed( 'interwiki' );
3431
3532 $this->setHeaders();
@@ -326,4 +323,4 @@
327324 $wgOut->wrapWikiMsg( "<p class='error'>$1</p>", $args );
328325 }
329326
330 -}
\ No newline at end of file
 327+}
Index: trunk/extensions/Babel/Babel.class.php
@@ -26,10 +26,6 @@
2727 // to the parameters passed to the babel parser function.
2828 unset( $parameters[ 0 ] );
2929
30 - // Load the extension messages in basic languages (en, content and
31 - // user).
32 - wfLoadExtensionMessages( 'Babel' );
33 -
3430 // Load various often used messages into the message member variables.
3531 $this->_getMessages();
3632
@@ -231,13 +227,6 @@
232228 // Get MediaWiki supported language codes\names.
233229 $nativeNames = Language::getLanguageNames();
234230
235 - // Load extension messages for box language and it's fallback if it is
236 - // a valid MediaWiki language.
237 - if ( array_key_exists( $code, $nativeNames ) ) {
238 - wfLoadExtensionMessages( 'Babel', $code );
239 - wfLoadExtensionMessages( 'Babel', Language::getFallbackFor( $code ) );
240 - }
241 -
242231 // Get the language names.
243232 $name = BabelLanguageCodes::getName( $code );
244233
Index: trunk/extensions/Babel/BabelAutoCreate.class.php
@@ -11,7 +11,6 @@
1212 * Abort user creation if the username is that of the autocreation username.
1313 */
1414 public static function RegisterAbort( User $user, &$message ) {
15 - wfLoadExtensionMessages( 'Babel' );
1615 $message = wfMsg( 'babel-autocreate-abort', wfMsg( 'babel-url' ) );
1716 return !( $user->getName() === wfMsgForContent( 'babel-autocreate-user' ) );
1817 }
Index: trunk/extensions/Validator/Validator.php
@@ -88,7 +88,8 @@
8989 function efValidatorSetup() {
9090 // This function has been deprecated in 1.16, but needed for earlier versions.
9191 // It's present in 1.16 as a stub, but lets check if it exists in case it gets removed at some point.
92 - if ( function_exists( 'wfLoadExtensionMessages' ) ) {
 92+ global $wgVersion;
 93+ if ( version_compare( $wgVersion, '1.15', '<=' ) ) {
9394 wfLoadExtensionMessages( 'Validator' );
9495 }
9596
Index: trunk/extensions/Maps/Maps.php
@@ -160,11 +160,11 @@
161161 * @return true
162162 */
163163 function efMapsSetup() {
164 - global $wgExtensionCredits, $wgLang, $wgExtraNamespaces, $wgNamespaceAliases;
 164+ global $wgExtensionCredits, $wgLang, $wgExtraNamespaces, $wgNamespaceAliases, $wgVersion;
165165
166166 // This function has been deprecated in 1.16, but needed for earlier versions.
167167 // It's present in 1.16 as a stub, but lets check if it exists in case it gets removed at some point.
168 - if ( function_exists( 'wfLoadExtensionMessages' ) ) {
 168+ if ( version_compare( $wgVersion, '1.15', '<=' ) ) {
169169 wfLoadExtensionMessages( 'Maps' );
170170 }
171171
Index: trunk/extensions/APC/SpecialAPC.php
@@ -45,7 +45,7 @@
4646
4747 public function execute( $parameters ) {
4848 global $wgOut, $wgScriptPath, $wgStyleVersion, $wgUser;
49 - wfLoadExtensionMessages( 'APC' );
 49+
5050 $this->setHeaders();
5151 $this->setup();
5252
Index: trunk/extensions/WebChat/WebChat_body.php
@@ -1,5 +1,4 @@
22 <?php
3 -
43 /**
54 * WebChat extension special page class.
65 */
@@ -13,7 +12,7 @@
1413 function execute( $par ) {
1514 global $wgOut, $wgUser, $wgWebChatServer, $wgWebChatChannel,
1615 $wgWebChatClient, $wgWebChatClients;
17 - wfLoadExtensionMessages( 'WebChat' );
 16+
1817 $this->setHeaders();
1918 $wgOut->addWikiMsg( 'webchat-header' );
2019
@@ -60,5 +59,4 @@
6160 ) );
6261
6362 }
64 -
6563 }
Index: trunk/extensions/LanguageSelector/LanguageSelector.php
@@ -95,7 +95,6 @@
9696 }
9797
9898 function wfLanguageSelectorExtension() {
99 - wfLoadExtensionMessages( 'LanguageSelector' );
10099 global $wgLanguageSelectorLanguages, $wgLanguageSelectorDetectLanguage,
101100 $wgLanguageSelectorRequestedLanguage, $wgLanguageSelectorLocation,
102101 $wgLanguageSelectorShowAll, $wgCommandLineMode;
Index: trunk/extensions/GoogleAdSense/GoogleAdSense.class.php
@@ -28,7 +28,6 @@
2929 return $bar;
3030 }
3131
32 - wfLoadExtensionMessages( 'GoogleAdSense' );
3332 $bar['googleadsense'] = "<script type=\"text/javascript\">
3433 /* <![CDATA[ */
3534 google_ad_client = \"$wgGoogleAdSenseClient\";
Index: trunk/extensions/ReplaceText/SpecialReplaceText.php
@@ -1,15 +1,11 @@
22 <?php
33
4 -if ( !defined( 'MEDIAWIKI' ) ) die();
5 -
64 class ReplaceText extends SpecialPage {
7 -
85 /**
96 * Constructor
107 */
118 public function __construct() {
129 parent::__construct( 'ReplaceText', 'replacetext' );
13 - wfLoadExtensionMessages( 'ReplaceText' );
1410 }
1511
1612 function execute( $query ) {
Index: trunk/extensions/I18nTags/I18nTags.php
@@ -33,7 +33,6 @@
3434 $parser->setHook( 'grammar', array($class, 'grammar') );
3535 $parser->setHook( 'plural', array($class, 'plural') );
3636 $parser->setHook( 'linktrail', array($class, 'linktrail') );
37 - wfLoadExtensionMessages( 'I18nTags' ); // FOR BC
3837 $parser->setFunctionHook( 'languagename', array($class, 'languageName' ) );
3938 return true;
4039 }
Index: trunk/extensions/UserMerge/UserMerge_body.php
@@ -20,8 +20,6 @@
2121 function execute( $par ) {
2222 global $wgRequest, $wgOut, $wgUser;
2323
24 - wfLoadExtensionMessages( 'UserMerge' );
25 -
2624 $this->setHeaders();
2725
2826 if ( !$wgUser->isAllowed( 'usermerge' ) ) {
Index: trunk/extensions/CleanChanges/CleanChanges_body.php
@@ -56,7 +56,6 @@
5757 protected $direction = true;
5858
5959 public function __construct( $skin ) {
60 - wfLoadExtensionMessages( 'CleanChanges' );
6160 global $wgLang;
6261 parent::__construct( $skin );
6362 $this->direction = !$wgLang->isRTL();
Index: trunk/extensions/CleanChanges/Filters.php
@@ -26,7 +26,6 @@
2727 }
2828
2929 public static function userForm( &$items, $opts ) {
30 - wfLoadExtensionMessages( 'CleanChanges' );
3130 $opts->consumeValue( 'users' );
3231 global $wgRequest;
3332
@@ -50,8 +49,6 @@
5150 }
5251
5352 public static function trailerForm( &$items, $opts ) {
54 - wfLoadExtensionMessages( 'CleanChanges' );
55 -
5653 $opts->consumeValue( 'trailer' );
5754
5855 global $wgRequest;

Follow-up revisions

RevisionCommit summaryAuthorDate
r78410Re-added wfLoadExtensionMessages(), for backward compatibility, removed by si...yaron23:28, 14 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78122* remove wfSeedRandom() which was marked for removal in 1.18....siebrand11:31, 9 December 2010

Comments

#Comment by Reedy (talk | contribs)   12:46, 9 December 2010

=D

#Comment by Reach Out to the Truth (talk | contribs)   14:19, 9 December 2010

Maps and Validator contain a comment about checking for the method's existence, which is no longer accurate.

#Comment by Yaron Koren (talk | contribs)   15:25, 9 December 2010

Hi Siebrand,

How come only Maps and Validator get special handling? I want my extension, Replace Text, to work with MW 1.15, and I wouldn't be surprised if other extensions' authors felt the same way.

#Comment by Siebrand (talk | contribs)   15:36, 9 December 2010

Your extension ReplaceText from the 1.17 branch does work with 1.15 (as well as the ones in branches 1.16 and 1.15). The one from trunk does not.

#Comment by Yaron Koren (talk | contribs)   15:43, 9 December 2010

Oh man... we had a very similar discussion about a month ago, and it led to the creation of this page: http://www.mediawiki.org/wiki/Backward_compatibility . Basically, I would like any future improvements I make to Replace Text (or any other extension) to be usable by MW 1.15 and earlier as well, if possible.

Status & tagging log