r27903 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r27902‎ | r27903 | r27904 >
Date:20:29, 27 November 2007
Author:tlaqua
Status:old
Tags:
Comment:
Adding backwards compatibility f/ message cache population.
Modified paths:
  • /trunk/extensions/ContributionScores/ContributionScores.php (modified) (history)
  • /trunk/extensions/ContributionScores/ContributionScores_body.php (modified) (history)
  • /trunk/extensions/StalePages/StalePages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/StalePages/StalePages_body.php
@@ -27,6 +27,7 @@
2828 }
2929
3030 function execute( $parameters ) {
 31+ global $wgVersion;
3132 if( version_compare( $wgVersion, '1.12alpha', '>=' ) ) {
3233 wfLoadExtensionMessages( 'Stalepages' );
3334 }
Index: trunk/extensions/ContributionScores/ContributionScores_body.php
@@ -92,9 +92,12 @@
9393 }
9494
9595 function execute( $par ) {
96 - global $wgRequest, $wgOut, $contribScoreReports;
97 - wfLoadExtensionMessages( 'ContributionScores' );
98 -
 96+ global $wgRequest, $wgOut, $contribScoreReports, $wgVersion;
 97+
 98+ if( version_compare( $wgVersion, '1.12alpha', '>=' ) ) {
 99+ wfLoadExtensionMessages( 'ContributionScores' );
 100+ }
 101+
99102 $this->setHeaders();
100103
101104 # Get request data from, e.g.
Index: trunk/extensions/ContributionScores/ContributionScores.php
@@ -12,13 +12,28 @@
1313 $wgExtensionCredits['specialpage'][] = array(
1414 'name'=>'Contribution Scores',
1515 'url'=>'http://www.mediawiki.org/wiki/Extension:Contribution_Scores',
16 - 'author'=>'Tim Laqua, Siebrand Mazeland',
 16+ 'author'=>'Tim Laqua',
1717 'description'=>'Polls wiki database for highest user contribution volume',
1818 'version'=>'1.5'
1919 );
2020
21 -$dir = dirname(__FILE__) . '/';
22 -$wgExtensionMessagesFiles['ContributionScores'] = $dir . 'ContributionScores.i18n.php';
2321 $wgAutoloadClasses['ContributionScores'] = $dir . 'ContributionScores_body.php';
 22+$wgSpecialPages['ContributionScores'] = 'ContributionScores';
2423
25 -$wgSpecialPages['ContributionScores'] = 'ContributionScores';
 24+if( version_compare( $wgVersion, '1.12alpha', '>=' ) ) {
 25+ $dir = dirname(__FILE__) . '/';
 26+ $wgExtensionMessagesFiles['ContributionScores'] = $dir . 'ContributionScores.i18n.php';
 27+} else {
 28+ $wgExtensionFunctions[] = 'efContributionScores';
 29+}
 30+
 31+///Message Cache population for versions that did not support $wgExtensionFunctions
 32+function efContributionScores() {
 33+ global $wgMessageCache;
 34+
 35+ #Add Messages
 36+ require( dirname( __FILE__ ) . '/ContributionScores.i18n.php' );
 37+ foreach( $messages as $key => $value ) {
 38+ $wgMessageCache->addMessages( $messages[$key], $key );
 39+ }
 40+}

Status & tagging log