r29548 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r29547‎ | r29548 | r29549 >
Date:19:28, 10 January 2008
Author:aaron
Status:old
Tags:
Comment:
Load messages only when needed
Modified paths:
  • /trunk/extensions/DeletedContributions/SpecialDeletedContributions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DeletedContributions/SpecialDeletedContributions.php
@@ -15,10 +15,11 @@
1616
1717 # Internationalisation
1818 $wgExtensionMessagesFiles['DeletedContributions'] = dirname(__FILE__) . '/DeletedContributions.i18n.php';
19 -$wgExtensionFunctions[] = 'efLoadDeletedContribsMessages';
 19+$wgExtensionFunctions[] = 'efLoadDeletedContribs';
2020
2121 global $wgHooks;
2222 $wgHooks['ContributionsToolLinks'][] = 'wfLoadContribsLink';
 23+$wgHooks['SpecialPageExecuteBeforeHeader'][] = 'wfDeletedContributionsMessages';
2324
2425 /**
2526 * Add a "Deleted contributions" link to Special:Contributions for sysops.
@@ -26,6 +27,8 @@
2728 function wfLoadContribsLink( $id, $nt, &$links ) {
2829 global $wgUser;
2930 if( $wgUser->isAllowed( 'deletedhistory' ) ) {
 31+ wfLoadExtensionMessages( 'DeletedContributions' );
 32+
3033 $links[] = $wgUser->getSkin()->makeKnownLinkObj(
3134 SpecialPage::getTitleFor( 'DeletedContributions', $nt->getDBkey() ),
3235 wfMsgHtml( 'deletedcontributions' )
@@ -34,9 +37,17 @@
3538 return true;
3639 }
3740
38 -function efLoadDeletedContribsMessages() {
 41+function wfDeletedContributionsMessages( $specialpage, $par, $func ) {
 42+ if( $specialpage->name() == 'DeletedContributions' ) {
 43+ wfLoadExtensionMessages( 'DeletedContributions' );
 44+ $specialpage->setHeaders(); // set again so that it actually has the fucking message
 45+ }
 46+ return true;
 47+}
 48+
 49+# Load once IndexPager and stuff is loaded
 50+function efLoadDeletedContribs() {
3951 require( dirname( __FILE__ ) . '/DeletedContributions_body.php' );
40 - wfLoadExtensionMessages( 'DeletedContributions' );
4152 }
4253
4354 $wgSpecialPages['DeletedContributions'] = array( 'SpecialPage', 'DeletedContributions', 'deletedhistory',

Status & tagging log