r78498 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78497‎ | r78498 | r78499 >
Date:17:39, 16 December 2010
Author:yaron
Status:deferred
Tags:
Comment:
Added new loadMessages() function, which is a wrapper around wfLoadExtensionMessages() so that it's only called for MW < 1.16
Modified paths:
  • /trunk/extensions/ApprovedRevs/ApprovedRevs.hooks.php (modified) (history)
  • /trunk/extensions/ApprovedRevs/ApprovedRevs_body.php (modified) (history)
  • /trunk/extensions/ApprovedRevs/SpecialApprovedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ApprovedRevs/ApprovedRevs_body.php
@@ -204,4 +204,11 @@
205205 $wgOut->addLink( $link );
206206 }
207207
 208+ public static function loadMessages() {
 209+ // for backwards compatibility
 210+ if ( version_compare( $wgVersion, '1.16', '<' ) ) {
 211+ wfLoadExtensionMessages( 'ApprovedRevs' );
 212+ }
 213+ }
 214+
208215 }
Index: trunk/extensions/ApprovedRevs/SpecialApprovedRevs.php
@@ -15,7 +15,7 @@
1616 */
1717 function __construct() {
1818 parent::__construct( 'ApprovedRevs' );
19 - wfLoadExtensionMessages( 'ApprovedRevs' );
 19+ ApprovedRevs::loadMessages();
2020 }
2121
2222 function execute( $query ) {
Index: trunk/extensions/ApprovedRevs/ApprovedRevs.hooks.php
@@ -186,7 +186,7 @@
187187 }
188188
189189 ApprovedRevs::addCSS();
190 - wfLoadExtensionMessages( 'ApprovedRevs' );
 190+ ApprovedRevs::loadMessages();
191191 if ( $revisionID == $article->getLatest() ) {
192192 $text = Xml::element(
193193 'span',
@@ -236,7 +236,7 @@
237237 $latestRevID = $title->getLatestRevID();
238238 if ( ! empty( $approvedRevID ) && $approvedRevID != $latestRevID ) {
239239 ApprovedRevs::addCSS();
240 - wfLoadExtensionMessages( 'ApprovedRevs' );
 240+ ApprovedRevs::loadMessages();
241241 global $wgOut;
242242 $wgOut->addHTML( '<p class="approvedRevsEditWarning">' . wfMsg( 'approvedrevs-editwarning' ) . "</p>\n" );
243243 }
@@ -256,6 +256,7 @@
257257 $latestRevID = $wgTitle->getLatestRevID();
258258 if ( ! empty( $approvedRevID ) && $approvedRevID != $latestRevID ) {
259259 ApprovedRevs::addCSS();
 260+ ApprovedRevs::loadMessages();
260261 $preFormHTML .= '<p><strong>' . wfMsg( 'approvedrevs-editwarning' ) . "</strong></p>\n";
261262 }
262263 return true;
@@ -315,7 +316,7 @@
316317 $approvedRevID = ApprovedRevs::getApprovedRevID( $article->getTitle() );
317318 $article->approvedRevID = $approvedRevID;
318319 // also load extension messages, while we're at it
319 - wfLoadExtensionMessages( 'ApprovedRevs' );
 320+ ApprovedRevs::loadMessages();
320321 return true;
321322 }
322323

Status & tagging log