r103426 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103425‎ | r103426 | r103427 >
Date:00:55, 17 November 2011
Author:johnduhart
Status:ok
Tags:
Comment:
Added context where possible to main AbuseFilter class

Most of the rest cannot get a context since it originates from hooks with no context sources. Instead of just getting the main context we might as well wait for a proper solution.
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.class.php (modified) (history)
  • /trunk/extensions/AbuseFilter/special/SpecialAbuseFilter.php (modified) (history)
  • /trunk/extensions/AbuseFilter/special/SpecialAbuseLog.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/special/SpecialAbuseLog.php
@@ -25,7 +25,7 @@
2626 $out = $this->getOutput();
2727 $request = $this->getRequest();
2828
29 - AbuseFilter::addNavigationLinks( $out, $this->getSkin(), 'log' );
 29+ AbuseFilter::addNavigationLinks( $this->getContext(), 'log' );
3030
3131 $this->setHeaders();
3232 $this->outputHeader( 'abusefilter-log-summary' );
Index: trunk/extensions/AbuseFilter/special/SpecialAbuseFilter.php
@@ -95,7 +95,7 @@
9696 }
9797
9898 // Links at the top
99 - AbuseFilter::addNavigationLinks( $out, $this->getSkin(), $pageType );
 99+ AbuseFilter::addNavigationLinks( $this->getContext(), $pageType );
100100
101101 $v = new $view( $this, $params );
102102 $v->show();
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php
@@ -120,8 +120,7 @@
121121 );
122122 public static $editboxName = null;
123123
124 - public static function addNavigationLinks( $out, $sk, $pageType ) {
125 - global $wgLang, $wgUser;
 124+ public static function addNavigationLinks( IContextSource $context, $pageType ) {
126125 $linkDefs = array(
127126 'home' => 'Special:AbuseFilter',
128127 'recentchanges' => 'Special:AbuseFilter/history',
@@ -130,7 +129,7 @@
131130 'log' => 'Special:AbuseLog',
132131 );
133132
134 - if ( $wgUser->isAllowed( 'abusefilter-modify' ) ) {
 133+ if ( $context->getUser()->isAllowed( 'abusefilter-modify' ) ) {
135134 $linkDefs = array_merge( $linkDefs, array(
136135 'tools' => 'Special:AbuseFilter/tools',
137136 'import' => 'Special:AbuseFilter/import',
@@ -160,16 +159,16 @@
161160 if ( $name == $pageType ) {
162161 $links[] = Xml::tags( 'strong', null, $msg );
163162 } else {
164 - $links[] = $sk->link( $title, $msg );
 163+ $links[] = $context->getSkin()->link( $title, $msg );
165164 }
166165 }
167166
168 - $linkStr = wfMsg( 'parentheses', $wgLang->pipeList( $links ) );
 167+ $linkStr = wfMsg( 'parentheses', $context->getLang()->pipeList( $links ) );
169168 $linkStr = wfMsgExt( 'abusefilter-topnav', 'parseinline' ) . " $linkStr";
170169
171170 $linkStr = Xml::tags( 'div', array( 'class' => 'mw-abusefilter-navigation' ), $linkStr );
172171
173 - $out->setSubtitle( $linkStr );
 172+ $context->getOutput()->setSubtitle( $linkStr );
174173 }
175174
176175 /**

Status & tagging log